1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

php 4.1x hack

Discussion in 'Co-op Advertising Network' started by adigaskell, Nov 2, 2004.

  1. #1
    Hi,

    Been trying to get this to work, it seems that Shawn has made a hack for people without php4.3 servers. I've had a search on the forum for it but can't find it anywhere.

    Can anyone help?

    Adi
    SEMrush
     
    adigaskell, Nov 2, 2004 IP
    SEMrush
  2. digitalpoint

    digitalpoint Overlord of no one Staff

    Messages:
    38,297
    Likes Received:
    2,602
    Best Answers:
    461
    Trophy Points:
    710
    Digital Goods:
    29
    #2
    digitalpoint, Nov 2, 2004 IP
  3. Patient

    Patient Raider

    Messages:
    336
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    123
    #3
    If you plan to run more than one ad you will need to hack the hack.

    You will need to move the additional code to a seperate file and in ad_network.php include_once the new file.

    Otherwise you will get a fatal error by defining file_get_contents more than once.
     
    Patient, Nov 2, 2004 IP
  4. digitalpoint

    digitalpoint Overlord of no one Staff

    Messages:
    38,297
    Likes Received:
    2,602
    Best Answers:
    461
    Trophy Points:
    710
    Digital Goods:
    29
    #4
    You could also probably get tricky and use the function_exists() function...
     
    digitalpoint, Nov 2, 2004 IP
  5. adigaskell

    adigaskell Peon

    Messages:
    59
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    I've re-tried the procedure, using the code from the setup page + the hack added to the ad_network.php file and I get

    Fatal error: Cannot redeclare file_get_contents() in Forum/ad_network.php on line 3

    Any ideas?
     
    adigaskell, Nov 3, 2004 IP
  6. Patient

    Patient Raider

    Messages:
    336
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    123
    #6
    See my earlier post. If you are running more than one ad you need to move the hack into a new file and include_once that file in ad_network.php.

    Otherwise the page will try and redeclare the function.
     
    Patient, Nov 3, 2004 IP
  7. adigaskell

    adigaskell Peon

    Messages:
    59
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #7
    Now I seem to be having trouble with the text file not having the right permissions, even though I've changed it to 777 via both ftp and file manager.

    The ads should be at the bottom of http://www.theenvironmentsite.org/Forum/
     
    adigaskell, Nov 3, 2004 IP
  8. Patient

    Patient Raider

    Messages:
    336
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    123
    #8
    Not sure if I can help but its worth noting that the script will generate that message if it can't find the txt file.

    Can you check the txt file is in the right place and that ad_network.php can find the txt file.
     
    Patient, Nov 3, 2004 IP
  9. adigaskell

    adigaskell Peon

    Messages:
    59
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #9
    There is definately a file there. If the reference to it in ad_network.php is just 'ad_network_ads.txt' as in the original setup file than the page is really (really) slow to load. If I include the full path then it loads but with the 'cannot find the text file' message.

    Very strange.
     
    adigaskell, Nov 3, 2004 IP
  10. Patient

    Patient Raider

    Messages:
    336
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    123
    #10
    You cannot use an absolute url to the txt file. I have been through that already and it is ruled out because the script can read the file but not write to the file.

    As a result you must use the straightforward ad_network_ads.txt

    My experience with the script is that it is all very quick to load.
     
    Patient, Nov 3, 2004 IP
  11. digitalpoint

    digitalpoint Overlord of no one Staff

    Messages:
    38,297
    Likes Received:
    2,602
    Best Answers:
    461
    Trophy Points:
    710
    Digital Goods:
    29
    #11
    You can use a absolute path, just not a URL.
     
    digitalpoint, Nov 3, 2004 IP
  12. Patient

    Patient Raider

    Messages:
    336
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    123
    #12
    How can I find the absolute path Shawn. Is there perhaps a php variable available with that path?

    I obviously misunderstood your reply yesterday as I had given up on absolute paths (must remember to read more carefully).
     
    Patient, Nov 3, 2004 IP
  13. digitalpoint

    digitalpoint Overlord of no one Staff

    Messages:
    38,297
    Likes Received:
    2,602
    Best Answers:
    461
    Trophy Points:
    710
    Digital Goods:
    29
    #13
    Make a PHP script like so:

    <?php
    	echo $_SERVER['SCRIPT_FILENAME'];
    ?>
    PHP:
    That will show you the full server path to your script, and you should be able to figure it out from there.
     
    digitalpoint, Nov 3, 2004 IP
  14. Patient

    Patient Raider

    Messages:
    336
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    123
    #14
    Thanks a lot.
     
    Patient, Nov 3, 2004 IP
  15. adigaskell

    adigaskell Peon

    Messages:
    59
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #15
    Seems to all work but the connection to the digitalpoint link file timed out.
     
    adigaskell, Nov 3, 2004 IP
  16. Patient

    Patient Raider

    Messages:
    336
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    123
    #16
    I've never had a problem with speed - I would suggest that your set-up still isn't right.

    At least I am no longer a Peon:

    pe·on ( P ) Pronunciation Key (pn, pn)
    n.

    An unskilled laborer or farm worker of Latin America or the southwest United States.
    Such a worker bound in servitude to a landlord creditor.
    A menial worker; a drudge.
    (also pyn) In India and other parts of South and Southeast Asia, a person of menial position, especially a messenger, servant, or foot soldier.


    Whether a Grunt is that much better I'm not sure.
     
    Patient, Nov 3, 2004 IP
  17. adigaskell

    adigaskell Peon

    Messages:
    59
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #17
    I've copy and pasted the code directly into the appropriate files. Can't really go wrong can it? Yet still the site hangs badly. I've tried accessing the http://ads.digitalpoint.com/network.php?type=link page and this loads fine, yet my site doesn't. I get this error message:

    Warning: file_get_contents(http://ads.digitalpoint.com/network.php?type=link): failed to open stream: Connection timed out in /home/httpd/vhosts/theenvironmentsite.org/httpdocs/Forum/ad_network.php on line 17
     
    adigaskell, Nov 8, 2004 IP