Ad PHP script executes in HTML page, outputs nothing

Discussion in 'Co-op Advertising Network' started by tigertom, Mar 19, 2005.

  1. #1
    Using:

    .html and Server Side Includes (html files are made executable using .htaccess)
    Text file is chmod 666.

    Problem:

    The php file seems to execute, as the Server Side Include code calling it is not present in the HTML after the page loads.

    BUT: No ad shows up. There's nothing in the HTML code, as if the script executed, and outputted nothing.

    Note: Account is not validated, site is not validated. Ad is not present in all files on-site, as I've just started this, but I'd expect something to show up, when the page loads(?)

    Any clues appreciated.
     
    tigertom, Mar 19, 2005 IP
  2. digitalpoint

    digitalpoint Overlord of no one Staff

    Messages:
    38,334
    Likes Received:
    2,613
    Best Answers:
    462
    Trophy Points:
    710
    Digital Goods:
    29
    #2
    In the ad_network php file, you should see somethng towards the end that has the stsring ".shtml"... change that to ".html".
     
    digitalpoint, Mar 19, 2005 IP
  3. tigertom

    tigertom Peon

    Messages:
    69
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Thanks for the speedy reply. It didn't work :(

    The ad text file has ads in it, so that part is working, I suppose. How peculiar.
     
    tigertom, Mar 19, 2005 IP
  4. digitalpoint

    digitalpoint Overlord of no one Staff

    Messages:
    38,334
    Likes Received:
    2,613
    Best Answers:
    462
    Trophy Points:
    710
    Digital Goods:
    29
    #4
    You sure the files you are calling it from are .html?
     
    digitalpoint, Mar 19, 2005 IP
  5. tigertom

    tigertom Peon

    Messages:
    69
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #5
    To make darn sure, I put the following code in the php file:

    if (substr (@$_SERVER['DOCUMENT_NAME'], -6) == '.htm' || substr (@$_SERVER['DOCUMENT_NAME'], -6) == '.html' || substr (@$_SERVER['DOCUMENT_NAME'], -6) == '.shtml')

    =========

    I also noticed that there are inappropriate ads in the .txt file. I specified real estate, and while there's a fair few real estate links, there's more for heart monitors, playing guitar, AIM Buddy icons, Samurai swords and other junk.
     
    tigertom, Mar 19, 2005 IP
  6. digitalpoint

    digitalpoint Overlord of no one Staff

    Messages:
    38,334
    Likes Received:
    2,613
    Best Answers:
    462
    Trophy Points:
    710
    Digital Goods:
    29
    #6
    You can try taking out the whole "if" statement line (and the closing bracket).
     
    digitalpoint, Mar 19, 2005 IP
  7. tigertom

    tigertom Peon

    Messages:
    69
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #7
    That did the trick! Thanks a lot :) Do you know why the 'junk' ads are in the text file?
     
    tigertom, Mar 19, 2005 IP
  8. digitalpoint

    digitalpoint Overlord of no one Staff

    Messages:
    38,334
    Likes Received:
    2,613
    Best Answers:
    462
    Trophy Points:
    710
    Digital Goods:
    29
    #8
    All ads are reviewed by a human. Do you have a specific example of an ad you think violates the terms of service?
     
    digitalpoint, Mar 19, 2005 IP
  9. tigertom

    tigertom Peon

    Messages:
    69
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #9
    Its not the ads per se, it's the type. I thought that if I specified a real-estate category for MY one ad, I'd only be serving real-estate ads. Saying it like that, I realise it doesn't follow. My mistake.

    Thanks for the help. I've got it working now. BUT, I've just put the include code, to call the PHP file, in a PHP file, (commented out ini_set ('zlib.output_compression', 0);, as that was giving a 'headers already set' error,) now the only bug is that the two links showing run into each other i.e. no space or pipe separating them:

    Example: Scroll to bottom of tigertom.co.uk/real-estate-agent-uk/index.php
     
    tigertom, Mar 19, 2005 IP
  10. digitalpoint

    digitalpoint Overlord of no one Staff

    Messages:
    38,334
    Likes Received:
    2,613
    Best Answers:
    462
    Trophy Points:
    710
    Digital Goods:
    29
    #10
    Add some spacing or something between them.
     
    digitalpoint, Mar 19, 2005 IP
  11. tigertom

    tigertom Peon

    Messages:
    69
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #11
    I think I'm going mental. I uncommented the zlib call, and now that works fine.

    Two links are still showing, but the PHP script should be being called only once. That two links are showing consecutively like that suggests the script is putting two ads into the $ad_network scalar, or something.

    I'm not trying to get two links to display, only one. Peculiar.

    I know enough about HTML to put a space in, if that was the problem ;)

    IDEA: Perhaps it's because the file, that I put the PHP call code in, is itself an include file, it's executing twice? Or something, in the code of the PHP file it's included in, is causing it to execute twice?
     
    tigertom, Mar 20, 2005 IP
  12. digitalpoint

    digitalpoint Overlord of no one Staff

    Messages:
    38,334
    Likes Received:
    2,613
    Best Answers:
    462
    Trophy Points:
    710
    Digital Goods:
    29
    #12
    Yeah, that would be my best guess (that's it's being executed twice for some reason). You are doing the SHTML include just once, right?
     
    digitalpoint, Mar 20, 2005 IP
  13. tigertom

    tigertom Peon

    Messages:
    69
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #13
    The problem page is a PHP one. I'm not using SSI in it. To get the code on all pages on my site, I'm putting it in a footer file, which is called by all the PHP pages of the Open Realty software I'm using.

    So your PHP script ...
    is being called by your PHP snippet ...
    which is in my footer 'include' file ....
    which my Open Realty software calls.

    Oh jiminy, I should just put your main PHP script code in my include file, not your snippet that 'calls' it, shouldn't I? Argh!

    Later: I did it, and it's fine now. Ha!

    Thanks for your help :)
     
    tigertom, Mar 20, 2005 IP