Jump to content

Recommended Posts

I couldn't find anything on this so I'm sorry in advanced if I missed something if it exists.

 

I created a file for my includes... Because there are several people working on this project I would like to include a different vars file for each person. I remember in the past a way to add the includes file to your web url using a &... but I can't remember...

 

Say the url is http://url.com/index.php and the includes file is called vars.php

 

What would be the address to include the file? Thanks in advance....

Link to comment
https://forums.phpfreaks.com/topic/297241-adding-an-includes-to-your-web-url/
Share on other sites

include("vars.php");//from same directory
include($_SERVER['DOCUMENT_ROOT']."/vars.php");//discovering root from anywhere

Could also do file_get_contents,curl, or even output buffering

Edited by QuickOldCar

Well for reason's of security clearances I want the people on this project to work with a different database, that will work in the area that they are working. I actually have the vars file that I include in the header. I could create 3 of them pointing to a different source and load the vars.php, vars1, vars2,  from the url. Or I can echo the contents using the parse_string parse_url command right into the variables themselves...

 

This is something that we want to use for development, most of the engineers are python developers and they are used to &= in python. So this suggestion came from them.  I would include my code but we have people at my work whose only job is to see what is going on with us on the outside.

 

Thank you for your question. :)

You want to pass a value in thru the calling url. Something like:

 

http://domain.com/page.php?incfile=myvars1.php

Or

http://domain.com/page.php?incfile=myvars2.php

 

What's to prevent the user from using the wrong value in their url? Perhaps you should consider putting the value in the login database so that when the user logs in you can get their value from the login process and set it up as a session variable.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.