SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Addict
    Join Date
    Feb 2001
    Location
    Shanghai, China
    Posts
    214
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hello, I think my problem is very similar to those of the guy some hours before with the php_session problem, but I can't find any solution.
    My problem is:
    I have a user-log in function which uses two session, one with the user-name and another one with the password. ( I took this from K.Yank's tutorial about User-login-functions)
    But when I change the password ( which actually is no problem with: ..update...) than the user automatically gets loged of, as the session password does not get the password which is still in the session-"password" ( I think that's the problem). So I think I will have to close the session password and reopen with the new password. But how to manage this. This way doesn work:

    session_unregister($pwd);
    session_destroy();

    session_register($pwd);

    Do you know any other solution?

    smorb ( Sorry for my bad english )

  2. #2
    SitePoint Author Kevin Yank's Avatar
    Join Date
    Apr 2000
    Location
    Melbourne, Australia
    Posts
    2,571
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    If a variable is already registered with the session, you should only have to update the variable's value.

    Here's how my password update page does its thing:

    PHP Code:
    // $userpassword is a session variable
    $sql "UPDATE user SET password=PASSWORD('$newpw') WHERE userid='$userid'";
    if (
    mysql_query($sql))
        
    $userpassword=$newpw
    Kevin Yank
    CTO, sitepoint.com
    I wrote: Simply JavaScript | BYO PHP/MySQL | Tech Times | Editize
    Baby’s got back—a hard back, that is: The Ultimate CSS Reference


Bookmarks

Posting Permissions

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