PHP error "Parse error: syntax error, unexpected T_ELSE in...

Binny

New member
...C:\xampp\htdocs\login.php on line 46"? im getting the error
Parse error: syntax error, unexpected T_ELSE in C:\xampp\htdocs\login.php on line 46
and dont really know why so. heres my code



session_start();
switch (@$_POST['Button'])
{
case "Log in":
include("rmb.php");
$cxn = mysqli_connect($host,$user,$password,$dbase)
or die("Query died: connect");
$sql = "SELECT username FROM Member
WHERE username='$_POST[fusername]'";
$result = mysqli_query($cxn,$sql)
or die("Query died: fusername: ".mysqli_error($cxn));
$num = mysqli_num_rows($result);
if($num > 0) //login name was found
{
$sql = "SELECT username FROM Member
WHERE username='$_POST[fusername]'
AND password=md5('$_POST[fpassword]')";
$result2 = mysqli_query($cxn,$sql)
or die("Query died: fpassword");
$num2 = mysqli_num_rows($result2);
if($num2 > 0) //password matches
{
$_SESSION['auth']="yes";
$_SESSION['logname'] = $_POST['fusername'];
$sql = "INSERT INTO Login (username,loginTime)
VALUES ('$_SESSION[logname]',NOW())";
$result = mysqli_query($cxn,$sql)
or die("Query died: insert");
header("Location: SecretPage.php");
}
else // password does not match
$message_1="The Login Name, '$_POST[fusername]'
exists, but you have not entered the
correct password! Please try again.";
$fusername = strip_tags(trim($_POST['fusername']));
include("form.php");
}
}
else // login name not found
{
$message_1 = "The User Name you entered does not
exist! Please try again.";
include("form.php");
}
break;

thanks =)
 
Back
Top