php session problem.

HateEternal

Mac Metal Head
I am having a weird session variable problem when I upload my code to my web server. It works fine on my personal linux test box which has an older version of php on it, but when it goes up it acts goofy and I dont understand why.

If i do this:

session_start();
$user = 'blah';
$pwd = 'xxxx';
$host = 'xcfsdf';
$db = 'sdfdff';

echo $_SESSION['user'];

it echos blah, or whatever the value of $user is.

$_session['user'] is initialized in a different page, it works if i echo it before setting $user so the session is working.

Did they change something since 4.2.2? If they did that is a stupid change.
 
Ok from what i have found, it has something to do with globals, i havent found a way to turn it off but whatever, for now ill just change my code.
 
HateEternal said:
Ok from what i have found, it has something to do with globals, i havent found a way to turn it off but whatever, for now ill just change my code.

yes, if u want the $user and $_SESSION["user"] are the same, u have to set Register_globals = ON. from php 4.x (dont remember :) ) the globals are set to OFF by default.

i advice u to use globals = OFF and use always $_SESSION, $_POST, $_GET etc etc, so your source is safer.
 
Back
Top