Function Redeclared

Discussion in 'Co-op Advertising Network' started by noppid, Sep 11, 2005.

  1. #1
    Could we possibly get the function file_get_contents_an wrapped in a conditional like function make_seed by default please?
    This became a problem using the archive hack for vB 3.0.x by zenon after upgrading to 374.

    ie.:
    
    if (!function_exists('file_get_contents_an')) {
        function file_get_contents_an($url) {
            ...code...
        }
    
    
    }
    
    PHP:
    Thanks
     
    noppid, Sep 11, 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
    It's probably a good thing to not put a conditional around it because the ad_network PHP should never be called more than once.
     
    digitalpoint, Sep 11, 2005 IP
  3. exam

    exam Peon

    Messages:
    2,434
    Likes Received:
    120
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Yeah Google shows 16,800 pages for file_get_contents_an
    ie:

    Fatal error: Cannot redeclare file_get_contents_an() (previously declared
    in /home/lakecs/public_html/forums/ad_network_226.php:5) in ...
     
    exam, Sep 11, 2005 IP
  4. exam

    exam Peon

    Messages:
    2,434
    Likes Received:
    120
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Right, but apparantly other software uses the exact same name file_get_contents_an for some function ? Maybe rename the function?
     
    exam, Sep 11, 2005 IP
  5. digitalpoint

    digitalpoint Overlord of no one Staff

    Messages:
    38,334
    Likes Received:
    2,613
    Best Answers:
    462
    Trophy Points:
    710
    Digital Goods:
    29
    #5
    You sure they are using it for their own function?
     
    digitalpoint, Sep 11, 2005 IP
  6. exam

    exam Peon

    Messages:
    2,434
    Likes Received:
    120
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Actually, I have no idea but it's not a php function... so do you think all those people are including the ad network code more than once?
     
    exam, Sep 11, 2005 IP
  7. digitalpoint

    digitalpoint Overlord of no one Staff

    Messages:
    38,334
    Likes Received:
    2,613
    Best Answers:
    462
    Trophy Points:
    710
    Digital Goods:
    29
    #7
    All what people? I'm lost.
     
    digitalpoint, Sep 11, 2005 IP
  8. exam

    exam Peon

    Messages:
    2,434
    Likes Received:
    120
    Best Answers:
    0
    Trophy Points:
    0
    #8
    Sorry, the people who have these pages.
     
    exam, Sep 11, 2005 IP
  9. digitalpoint

    digitalpoint Overlord of no one Staff

    Messages:
    38,334
    Likes Received:
    2,613
    Best Answers:
    462
    Trophy Points:
    710
    Digital Goods:
    29
    #9
    Only looks like it's around 30-40 sites, so yeah I would guess they are all including the ad_network PHP more than once.
     
    digitalpoint, Sep 11, 2005 IP
  10. exam

    exam Peon

    Messages:
    2,434
    Likes Received:
    120
    Best Answers:
    0
    Trophy Points:
    0
    #10
    I suppose you could wrap the entire script in
    if (!defined ('_DP_AD_NET_')) {
          define ('_DP_AD_NET_', 'hi there');
          ...
    }
    PHP:
    if you wanted to... but then again who knows why they would be including it more than once.
     
    exam, Sep 11, 2005 IP
  11. noppid

    noppid gunnin' for the quota

    Messages:
    4,246
    Likes Received:
    232
    Best Answers:
    0
    Trophy Points:
    135
    #11
    It's a flaw of the SEO archive by Zenon apparently. It calls global.php thus includes the ad_network.php in the php_include_first template, then we have to call it in the footer of the archive. Include_once didn't work and not including it in the footer, although it seems to have been included already, does not display ads.

    I have dealt with it quick and dirty, but did not have the desire to work it too hard last night. I can live with my fix for now, but I agree, I need to find out how NOT in have it include twice.

    Thanks
     
    noppid, Sep 12, 2005 IP