Weird Logon Problem
Posted: Wed Jul 30, 2008 8:20 am
Ok so heres the problem. I had a logon script that worked fine but wasn't as nice as I wanted. So I changed it around a little so after your logged on it will send you to the home page. Also it sets a few session variables and when they are set a User Menu pops up on the left of the screen. For some reason certain users have to log in twice to get it to work. It doesn't happen to me so I don't know whats wrong, but it does happen to several of my users. There is no common browser or even OS so I have no clue. The code is below:
Now this code is only executed if the password matches the password in the datebase. So for this code to be executed the username and password have already been verified. So for the person that has to log on twice this is what happens:
He/She logs on with correct Name and Password
The above code gets executed and they are Redirect to index.php
The problem is they are not logged in and the User menu does not show up so
He/She logs in again with the same info
The second time around they are always allowed in ?
Any idea why it takes two times for the above code to work for some people? For others like myself it works on the first try. Feel free to test out the real thing at SnuffReviews.com, just let me know to get rid of your account after.
Code: Select all
$lastlogin = date('Y-m-d H:i:s');
$sql = "UPDATE Users SET lastlogin='$lastlogin' WHERE UserID=$row[0]";
mysql_query($sql) or die("Can't insert last login info");
//echo "<span class=alert>You have been logged on! You may proceed!</span>";
$_SESSION['UN'] = (string)$row[1];
$_SESSION['UI'] = (int)$row[0];
$_SESSION['isAdmin'] = (int)$row[11];
header("Location: http://snuffreviews.com/index.php");
He/She logs on with correct Name and Password
The above code gets executed and they are Redirect to index.php
The problem is they are not logged in and the User menu does not show up so
He/She logs in again with the same info
The second time around they are always allowed in ?
Any idea why it takes two times for the above code to work for some people? For others like myself it works on the first try. Feel free to test out the real thing at SnuffReviews.com, just let me know to get rid of your account after.