Allright, so, I have a file which I want to include() in another script.. Now, the main script (The one with the include() statement) is passed a GET parameter in the URL which the second file (The one to be included) needs.. So, my question will now be, how can I pass the GET parameter from the main script to the second script? Thanks in advance Jon
By just calling $_GET['your_var']; Nothing special. Should work as is. Whatever is included can access the URL params (at least on my server). If that doesn't work for some odd reason, then whatever you do in the include, make it in a function. Then after you include it go: your_function($_GET['your_var']);
The problem is, you see, that there is another file included in the included file, which is the one which really need the variable.... But I don't know what it wants or how it gets it since it is a phpBB file.. I'm writing a script for keeping forum sessions alive all across my page... If I call the included file directly with the parameter in the URL, then it works...
How would you suggest I should do that with security in mind? And wouldn't that make the page slower to load? If the main page has to set a cookie every time it loads...
It only sets the cookie once. I don't think checking the set values slows it down that much. osCommerce does it that way when you select Force Cookie. You can check it out yourself how they do it, the code is in catalog/includes/application_top.php It actually uses a combination of cookies and MySQL session id storage. I don't know the intricacies.
I didn't think of that... What would you recommend setting the expiration time as? And, how would you recommend setting/checking the cookie? Just one question though, how will this help me with my problem? If the second script reads the cookie, will the input then be considered as the same as something in the URL? I don't see how else the included script in the second script can get info from the cookie..? And whats osCommerce?
Considering you're a newbie who's first post was a shameless question rather than an introduction or a contribution I will refrain from answering all that. It will be better for your learning experience to find out yourself.
1. Yes, I'm a newbie to PHP 2. Sorry about my lack of introduction, but I've posted this question onto multiple forums, because I wanted to get an answer as quick as possible.. Therefore I did not take the time to properly introduce myself on all the forums... 3. I think what I meant came out a bit wrong.. What I meant was, do you know any good ways of doing this, and if so, could you provide me with a guide to it as I would in fact like to learn it myself 4. I really do appreciate all the help Jon
You can use hidden field if you had form on the main script. Or the other way is passing the variable via URL and then fetch the variable on the second script.