There is no reason to ever use session_register() at all, and plenty of reason not to. The only reason PHP still supports it is for legacy code, even the manual discourages its use. [/B]
Ok, I checked those out now and you are right. And the manual says that I should not use them(session_register & $_SESSION) together. But the manual doesnt tell any rational reason why not to use session_register.
But anyway. Today I thought to change one of my sites to use $SESSION instead of session_register. I ran on to a problem.. I thought that the two are mostly the same thing so I changed the session_register to $SESSION. After changing, my login stopped working... Heres the code..(I have taken all Ifs and mysql-thingies out bcos they are not relevant)
session_start();
$sessid=session_id();
$_SESSION['userid'] = $userid;
$_SESSION['sessid'] = $sessid;
redir("blaah.php");
Ok, I have understood that now I can use those variables in page blaah.php after using session_start(). ( Like I did before with session_register )
It doesnt print the values of $SESSION['userid'] and $SESSION['sessid'] at all in the second page(eg. echo $_SESSION['userid']).
Funny, when I change the first code to:
session_start();
$sessid=session_id();
session_register('userid') = $userid;
$_SESSION['sessid'] = $sessid;
redir("blaah.php");
.. It shows both - $SESSION('userid') and $SESSION('sessid').
Why didnt it print sessid in the first code, but it prints it when I register userid? Why does registering 'userid' make $_SESSION('sessid') working?
Ok, I probaply didnt tell this the best way but I hope someone understands the little dilemma Im having now. I shouldnt use session_register at all, but then again it doesnt work with $_SESSION.