-
Session_register problem
For some reason this code does not work as intended:
PHP Code:
$kundetype = htmlspecialchars( stripslashes($row['btype']));
$b_id = htmlspecialchars( stripslashes($row['brukerid']));
if ($num_results > 0) {
session_register("innlogget", "tilgang", "sessbrukerid");
$innlogget = $navn;
$tilgang = $kundetype;
$sessbrukerid = $b_id;
}
The $innlogget and $tilgang variables are set with the right value, but somehow $sessbrukerid is set the same value as $tilgang ($kundetype).
Why does this happen? I've made sure to deregister all session variables one by one and destroy the session upon logout, but it still happens the next time I log in.
-
Do your assignments first:
PHP Code:
$innlogget = $navn;
$tilgang = $kundetype;
$sessbrukerid = $b_id;
...and then register them in session.
PHP Code:
session_register("innlogget", "tilgang", "sessbrukerid");
-
-
Ah, seems it was a problem with the values retrieved from the database, rather than with the session itself. Doh! :o
-
It's been a long week hasn't it? :p
-
Certainly has :)
I kept going till 6 AM last night and was back in action at noon...