malanno Posted July 9, 2015 Share Posted July 9, 2015 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.... Quote Link to comment https://forums.phpfreaks.com/topic/297241-adding-an-includes-to-your-web-url/ Share on other sites More sharing options...
QuickOldCar Posted July 10, 2015 Share Posted July 10, 2015 (edited) 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 July 10, 2015 by QuickOldCar Quote Link to comment https://forums.phpfreaks.com/topic/297241-adding-an-includes-to-your-web-url/#findComment-1516007 Share on other sites More sharing options...
malanno Posted July 10, 2015 Author Share Posted July 10, 2015 You did answer my question but I asked it wrong. Shame on me. What I meant is, http://example.com/main.php&="Contents to be echoed in the document." I'm wrestling with it now :/ Quote Link to comment https://forums.phpfreaks.com/topic/297241-adding-an-includes-to-your-web-url/#findComment-1516024 Share on other sites More sharing options...
requinix Posted July 10, 2015 Share Posted July 10, 2015 That's a bad thing to do. What is the problem you're trying to solve? Quote Link to comment https://forums.phpfreaks.com/topic/297241-adding-an-includes-to-your-web-url/#findComment-1516026 Share on other sites More sharing options...
malanno Posted July 10, 2015 Author Share Posted July 10, 2015 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. Quote Link to comment https://forums.phpfreaks.com/topic/297241-adding-an-includes-to-your-web-url/#findComment-1516077 Share on other sites More sharing options...
ginerjm Posted July 10, 2015 Share Posted July 10, 2015 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. Quote Link to comment https://forums.phpfreaks.com/topic/297241-adding-an-includes-to-your-web-url/#findComment-1516082 Share on other sites More sharing options...
QuickOldCar Posted July 10, 2015 Share Posted July 10, 2015 Do a normal login and through session assign the user whichever database want. You don't need to pass anything through a url. 1 Quote Link to comment https://forums.phpfreaks.com/topic/297241-adding-an-includes-to-your-web-url/#findComment-1516086 Share on other sites More sharing options...
scootstah Posted July 10, 2015 Share Posted July 10, 2015 Why not just have the developers configure their respective config files on their development environment? That is a fairly typical workflow. 1 Quote Link to comment https://forums.phpfreaks.com/topic/297241-adding-an-includes-to-your-web-url/#findComment-1516089 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.