Welcome to WebmasterWorld Guest from 50.19.34.234

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

[PHP] Not global variables?

     

GrodanBoll

10:21 am on Mar 15, 2002 (gmt 0)

10+ Year Member



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?

/Grodan :)

gethan

11:21 am on Mar 15, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Grodan,

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.

HTH

gethan

11:24 am on Mar 15, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



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

11:54 am on Mar 15, 2002 (gmt 0)

10+ Year Member



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?

/Grodan

gethan

12:03 pm on Mar 15, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



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

2:34 pm on Mar 15, 2002 (gmt 0)

10+ Year Member



Hi Grodan,

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.

 

Featured Threads

Hot Threads This Week

Hot Threads This Month