Concerning allow_url_fopen...

Discussion in 'Co-op Advertising Network' started by Hijacker, Feb 8, 2005.

  1. #1
    There is no way, that the php code could be coded without the allow_url_fopen function?

    I am sharing a dedicated server with some friends and the server already got defaced once. The reason why it was possible was the allow_url_fopen function. So now we all agreed that we won't enable it anymore, since it's a little security hole.

    You can take a look at my blog in my signature, the coop ads should be displayed at the bottom. There you see this error message.
    Yes, I already had a look at the FAQ, and yes, I red all those threads, mentioning exactly my problem, and yes, I do know (as described above) how to get it working again. So I don't need support in that way. Rather if the PHP piece could be changed somehow, to get it working without allow_url_fopen...?
     
    Hijacker, Feb 8, 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
    You could recode the file_get_contents function to do it somehow with direct network connections I suppose, but would add a lot of code to the ad_network.php file (not something I'm going to do).
     
    digitalpoint, Feb 8, 2005 IP
  3. Hijacker

    Hijacker Peon

    Messages:
    151
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Well, yea, of course, I don't want you to write Kilobytes of code just for me...

    Hum, so I got to discuss this with my mates again, maybe we can find another solution, otherwise I won't be able to take part in your network.
    Damn it =/
     
    Hijacker, Feb 8, 2005 IP
  4. crew

    crew Peon

    Messages:
    225
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    0
    #4
    One of my hosts allows you to use .htaccess to turn on allow_url_fopen for specific directories. I know nothing about it - just passing it along as a possible solution.
     
    crew, Feb 8, 2005 IP
  5. Hijacker

    Hijacker Peon

    Messages:
    151
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Hmmm, I guess this is the Locale/Master thingie I see, when I take a look at phpinfo()...

    Well, they're both set off.
     
    Hijacker, Feb 8, 2005 IP
  6. Hijacker

    Hijacker Peon

    Messages:
    151
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Wheeeey!!

    Guys, you won't believe - I finally got the ads working!
    I found a very very neat solution:
    In a PHP script you can put

    ini_set("allow_url_fopen", "1");
    PHP:
    at the beginning (or at whatever point it is needed),
    and then at the end of the PHP Script (or wherever it's needed) you can put:

    ini_set("allow_url_fopen", "0");
    PHP:
    Set with these functions, allow_url_fopen will be set to "On" just for the time, the script is executed (or even less time, if it's just placed before and after the function, using allow_url_fopen) and it will be set to "Off" again, just right after the regarding line in the code has been executed.


    For the Coop Ad Network, you would have to place them like this:

    			if ((count ($ads) < $ads_temp[3] + 1 && $ads_temp[0] + $ads_temp[5] < time()) || $ads_temp[0] + $ads_temp[4] < time()) {
    				ini_set("allow_url_fopen", "1");
    				$new_ad = file_get_contents ('http://ads.digitalpoint.com/network.php?b=' . $_SERVER['SERVER_NAME'] . '&type=link');
    				ini_set("allow_url_fopen", "0");
    				if ($new_ad) {
    PHP:

    That's lines 39-43.
    Now you are all set; Coop AdNetwork will work again and your webserver is most likely safe of eventual hacker attacks :)
    I am so happy, that the ads are working now... Weehe, that's great! =)



    Now another thingie:
    In my Coop AdNetwork account, it says
    " Ad Denied
    exclamation not needed"
    in front of my ad...

    Does that mean my ad won't be displayed? What's the reason? Somethin' wrong with it? :/
     
    Hijacker, Feb 20, 2005 IP
  7. flawebworks

    flawebworks Tech Services

    Messages:
    991
    Likes Received:
    36
    Best Answers:
    1
    Trophy Points:
    78
    #7
    flawebworks, Feb 20, 2005 IP
  8. Hijacker

    Hijacker Peon

    Messages:
    151
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #8
    Well, "exclamation not needed" points me to my mistake on a very good way... :rolleyes:

    Anyways, I'm gonna delete even the last ?s and !s in my ad and will shorten the anchor text even more...
     
    Hijacker, Feb 20, 2005 IP