Session_register problem

Sharky Forums


Results 1 to 6 of 6

Thread: Session_register problem

  1. #1
    Ex-*** kid A's Avatar
    Join Date
    Sep 2000
    Location
    Norway
    Posts
    5,322

    Session_register problem

    For some reason this code does not work as intended:

    PHP Code:
    $kundetype htmlspecialcharsstripslashes($row['btype']));
            
    $b_id htmlspecialcharsstripslashes($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.
    Last edited by kid A; 08-01-2003 at 08:31 AM.
    Now listening to various rock and metal
    143rd member to join Sharkyforums.

  2. #2
    Ursus Arctos Moderatis Grizzly's Avatar
    Join Date
    Sep 2000
    Location
    Providence, RI USA
    Posts
    3,077
    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"); 

  3. #3
    Ex-*** kid A's Avatar
    Join Date
    Sep 2000
    Location
    Norway
    Posts
    5,322
    Makes no difference...
    Now listening to various rock and metal
    143rd member to join Sharkyforums.

  4. #4
    Ex-*** kid A's Avatar
    Join Date
    Sep 2000
    Location
    Norway
    Posts
    5,322

    Red face

    Ah, seems it was a problem with the values retrieved from the database, rather than with the session itself. Doh!
    Now listening to various rock and metal
    143rd member to join Sharkyforums.

  5. #5
    Ursus Arctos Moderatis Grizzly's Avatar
    Join Date
    Sep 2000
    Location
    Providence, RI USA
    Posts
    3,077
    It's been a long week hasn't it?

  6. #6
    Ex-*** kid A's Avatar
    Join Date
    Sep 2000
    Location
    Norway
    Posts
    5,322
    Certainly has

    I kept going till 6 AM last night and was back in action at noon...
    Now listening to various rock and metal
    143rd member to join Sharkyforums.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •