Here's the code in question: I'd ideally want the user to only be directed to this page if login is successful. Directed to another page if unsuccessful but even the error messages do not display which I find strange...
/* Verify Login */ $sql = "SELECT UserFirstName,UserID,UserPassword,FurtherComments FROM RegisteredMembers WHERE UserID='$_POST[TXT_UserID]'"; $result = mysql_query($sql) or die ("could not select database"); $num = mysql_num_rows($result); if ($num == 1) //Login Name Was Found { $sql = "SELECT UserID FROM RegisteredMembers WHERE UserID='$_POST[TXT_UserID]' AND UserPassword=('$_POST[TXT_UserPassword]')"; $result2 = mysql_query($sql) or die("Couldn't execute query #2. MySQL Error: " . mysql_error()); $num2 = mysql_num_rows($result2); if ($num2 > 0) // password is correct { $_SESSION['auth']="yes"; $logname=$_POST['TXT_UserID']; $_SESSION['logname'] = $logname; $today = date("Y-m-d h:m:s"); $sql = "INSERT INTO Logon (loginName,loginTime) VALUES ('$logname','$today')"; mysql_query($sql) or die("Couldn't execute query. MySQL Error: " . mysql_error()); } else // password is not correct { unset($do); $message="The Login Name, '$_POST[TXT_UserID]' exists, but you have not entered the correct password! Please try again.<br>"; } } elseif ($num == 0) // login name not found { unset($do); $message = "The Login Name you entered does not exist! Please try again.<br>"; } -- ----------------------------- Michael Mason Arras People www.arraspeople.co.uk ----------------------------- "Harlequin" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hi all I've created a page that allows registered users who have previously > registered and been entered into the database to login. However, for some > reason if a user login fails my code does not display the appropriate error > message. > > Ideally I would like the users to be redirected to another page rather than > the login page if they fail but I need some help with the code. > > Anyone...? > > -- > ----------------------------- > Michael Mason > Arras People > www.arraspeople.co.uk > ----------------------------- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php