Welcome to WebmasterWorld Guest from 18.104.22.168 , register , free tools , login , search , subscribe , help , library , announcements , recent posts , open posts Accredited PayPal World Seller
[PHP] Not global variables? GrodanBoll msg:1278815 10:21 am on Mar 15, 2002 (gmt 0) Hi
I'm chaning in my script so I turn of the global variables in my php.ini (module version).
I know how to get variables from get ($_GET), and post ($_POST) but what about the session variables? I have registered them through the 'session_register' function.
How do I get those without the help of global variables?
gethan msg:1278816 11:21 am on Mar 15, 2002 (gmt 0)
Are you using session_start() ?
It needs to be called before "<html>" appears in your code. In the header section - as a rule where I use this I make it the first statement in my code. After that is used every variable that you set using session_register('var_name'); is available via $var_name.
gethan msg:1278817 11:24 am on Mar 15, 2002 (gmt 0)
Caveat: Use with caution if doing something where SEO is important. If cookies are not available then php postfixes all (local?) links with ?PHP_SESSION_ID=SDF2332fdfsD23423d etc.
This is what happens when the bots visit your page.
GrodanBoll msg:1278818 11:54 am on Mar 15, 2002 (gmt 0)
Hi again gethan :)
I am using session_start.
To get my sessions variables today I am just calling for $'var_name', what I am wonering is if I can use the same method it when I turn my global variables off in php.ini?
gethan msg:1278819 12:03 pm on Mar 15, 2002 (gmt 0)
Not something I've done before. I think you'll just have to try it out and see the results... you can always turn it back on again. Let me know :) David msg:1278820 2:34 pm on Mar 15, 2002 (gmt 0)
Looking at my PHP4 book. It says to think of a registered variable as a super global declaration. Also since your variable values are stored on the server by session ID I would think you could turn globals of in your ini file.
Caution: This is my best guess. I have never tried it.
Lets us know how it goes.