SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Member
    Join Date
    Oct 2012
    0 Post(s)
    0 Thread(s)

    Help with login!

    I am using the php-login script. Everything has been working fine but suddenly now when I try logging in with an account (called user1) that has always worked previously, it simply redirects me to the login page. It does not error, it just redirects. Although if I try another account (user 2), I login normally but this one account (user 1) just does not seem to not want to login and just keeps redirecting me back when I try logging in.

    Also, the script only works if I have the "Remember Me" box checked. I have a feeling that it is an issue with cookies, I have taken a code snippet here:
    PHP Code:
    session_regenerate_id (true); //prevent against session fixation attacks.
    // this sets variables in the session
    $_SESSION['user_id']= $id;
    $_SESSION['user_name'] = $full_name;
    $_SESSION['user_level'] = $user_level;

    //update the timestamp and key for cookie
    $stamp time();
    $ckey GenKey();
    mysql_query("update users set `ctime`='$stamp', `ckey` = '$ckey' where id='$id'") or die(mysql_error());

    //set a cookie

    setcookie("user_id"$_SESSION['user_id'], time()+60*60*24*365"/");
    setcookie("user_key"sha1($ckey), time()+60*60*24*365"/");
    setcookie("user_name",$_SESSION['user_name'], time()+60*60*24*365"/");
    header("Location: myaccount.php"); 
    Although, it may be other things. For further reference, the script I am using is from here:

    Last edited by SpacePhoenix; Oct 17, 2012 at 00:44. Reason: placed php tags around the php code

  2. #2
    From space with love silver trophy
    SpacePhoenix's Avatar
    Join Date
    May 2007
    Poole, UK
    103 Post(s)
    0 Thread(s)
    Was any changes made to the configuration of the server around the time the script stopped working properly?
    Community Team Advisor
    Forum Guidelines: Posting FAQ Signatures FAQ Self Promotion FAQ
    Help the Mods: What's Fluff? Report Fluff/Spam to a Moderator


Posting Permissions

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