1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Including one file across many addon domains?

Discussion in 'General Programming Chat' started by seeplusplus, Jun 1, 2011.

  1. seeplusplus

    seeplusplus Power Member

    Joined:
    Aug 18, 2008
    Messages:
    511
    Likes Received:
    163
    I have a regular LAMP shared hosting account.

    That account has one root domain, and 50 addon domains.

    I don't use the root domain at all.

    I want to be able to add my AdSense code to all 50 addon domains from one place (for efficiency), whilst leaving no footprint of this happening.


    I know you can pull remote URL resources using PHP's include() and require() functions, but my host has allow_url_fopen turned off, nor would I want to use it as it's insecure IMO.

    Has anyone got a simple ideas on how I could do this without using something drastic?

    Ideally I'd like to just upload a file, say adsensecode.php into the unused root domain, and be able to include the file in all the addon domains, as long as that doesn't leave a foot print.

    In regards to the footprint issue, I'm unsure, if I use include(././././adsensecode.php) for example to get to above public_html from an addon domains, then when the browser pulls the resource, it would see rootdomain.com/adsensecode.php instead across all the sites? Or perhaps not since all the sites are all on the same hosting account??


    Do you think setting up the addon domains like below would leave no footprints? :

    [​IMG]

    This is how I think it would work. The visitor/google/whatever goes to the site, the page is requested by the client from the server. The server's PHP engine executes the include() function, and the adsensecode.php file is fetched FROM the root domain's directory directly above it. Yes, this does technically occur between two domains (the inclusion of adsensecode.php), but, it is all executed INSIDE on the SAME server, so the visitor/google/whatever can not tell, at all.

    Do you think this is factually correct?

    Any ideas anyone?

    Maybe it can done in a much more simple way, but my knowledge of hosting sucks.

    Thanks very much.
     
    Last edited: Jun 1, 2011
  2. other_henry

    other_henry Junior Member

    Joined:
    Jun 1, 2011
    Messages:
    107
    Likes Received:
    19
    Occupation:
    Freelance coder, server guy
    Location:
    US
    No correctly configure shared hosting server will allow this. You can do it on a server where you have root access (VPS,dedi) and can change the permissions.

    The browser can't see any processing done by php so it can't see where the include file is located, it can't even see the include.
     
    • Thanks Thanks x 1