HUH?
Hi There -
This is a change password form. Tried nesting the if statements, but PHP didn't like it.
So I have a bunch of conditions for each if statement.
Here's the error I get:
Parse error: syntax error, unexpected '{' in ...interfacePassword.php on line 54
Line 54 is the line right after the second if statement. I've checked the parentheses, and I'm pretty sure I'm right, but have no idea what I'm doing wrong with this.
(also, if you see anything that could be improved - clarity, general practice, I'd love to hear it.)
Thanks!
Lee
Here's my code:
<?php session_start(); ?>
<html>
<div align="center">
<!-- customer Table Fields: | cust_ID | cust_Fname | cust_Lname | cust_phone | cust_Password | cust_Email | cust_address | cust_city | cust_state | cust_zip | locked_flag | Emp_id | -->
<?php
/************************ GET DATABASE PASSWORD AND OTHER VARIABLES **********/
if (isset($_POST['entered_Password_0']))
{
// CONNECTION
include("includes/connect2db.php");
// QUERY FOR PASSWORD EXISTING IN DATABASE
$sqlString="SELECT * from employee where Emp_Lname ='$Emp_Lname'";
// TEST $sqlString
echo ('sqlString = /"$sqlString/"');
$result=mysql_query($sqlString,$con);
$row = mysql_fetch_assoc ($result);
// SET VARIABLES
$cust_Password = ($row["cust_Password"]);
$entered_Password_0 = $_POST['entered_Password_0'];
$entered_Password_1 = $_POST['entered_Password_1'];
// TEST VARIABLES
echo ('Old password is $cust_Password.');
echo ('entered_Password_0 is $$entered_Password_0.');
echo ('entered_Password_1 is $$entered_Password_1.');
}
/************************ IF ALL PASSWORDS ARE CORRECT AND MATCH **************/
if ((isset($_POST['entered_Password_0']) AND ($entered_Password_0 == $cust_Password) AND (($_POST['entered_Password_1']) == ($_POST['entered_Password_2'])))
{
// SET VARIABLES
$cust_Password = $_POST['entered_Password_1'];
$cust_ID = $_SESSION['cust_ID'];
// TEST VARIABLES
echo ('$cust_Password');
echo ('$cust_ID');
// CHANGE PASSWORD IN DATABASE
$sqlString = "update customer set cust_Password='".$cust_Password ."' where cust_ID='".$cust_ID ."'";
// TEST $sqlString
echo ('sqlString = /"$sqlString/"');
$rs=mysql_query($sqlString,$con);
?>
<body bgcolor= "#6da9dc" text="#551a8b">
<br><br><br>
<center><h3>Password Updated Successfully</h3></center>
<?php include("includes/menu.php"); ?>
</body>
</html>
</html>
<?php
}
/************************ IF NEW PASSWORDS DON'T MATCH ****************************/
else if ((isset($_POST['entered_Password_0']) AND ($entered_Password_0 == $cust_Password) AND ($_POST['entered_Password_1']) !== ($_POST['entered_Password_2']))
{
echo "<b>** Passwords didn't match, please try again: **</b>";
?>
<form method="post" action="<?php echo($_SERVER['PHP_SELF']); ?>" >
<table>
<tr>
<td align='right'>Type Old Password: </td><td><input type="text" name="entered_Password_0" size="30"></td>
</tr>
<tr>
<td align='right'>Type Password: </td><td><input type="text" name="entered_Password_1" size="30"></td>
</tr>
<tr>
<td align='right'>Retype Password: </td><td><input type="text" name="entered_Password_2" size="30"></td>
</tr>
<tr>
<td align='right'><input type="submit" value="Login"> </td><td> <input type="reset" value="Clear"></td>
</tr>
</table
</form>
<?php
}
}
/************************ IF OLD PASSWORD DOESN'T MATCH ***********************/
else if ((isset($_POST['entered_Password_0']) AND ($entered_Password_0 !== $cust_Password))
{
echo "<b>** Your old password doesn't match, please try again: **</b>";
?>
<form method="post" action="<?php echo($_SERVER['PHP_SELF']); ?>" >
<table>
<tr>
<td align='right'>Type Old Password: </td><td><input type="text" name="entered_Password_0" size="30"></td>
</tr>
<tr>
<td align='right'>Type Password: </td><td><input type="text" name="entered_Password_1" size="30"></td>
</tr>
<tr>
<td align='right'>Retype Password: </td><td><input type="text" name="entered_Password_2" size="30"></td>
</tr>
<tr>
<td align='right'><input type="submit" value="Login"> </td><td> <input type="reset" value="Clear"></td>
</tr>
</table
</form>
<?php
}
/************************ (FRESH LOGIN SCREEN) ********************************/
else {
echo "<b>**Change Password**</b>";
?>
<form method="post" action="<?php echo($_SERVER['PHP_SELF']); ?>" >
<table>
<tr>
<td align='right'>Type Old Password: </td><td><input type="text" name="entered_Password_0" size="30"></td>
</tr>
<tr>
<td align='right'>Type Password: </td><td><input type="text" name="entered_Password_1" size="30"></td>
</tr>
<tr>
<td align='right'>Retype Password: </td><td><input type="text" name="entered_Password_2" size="30"></td>
</tr>
<tr>
<td align='right'><input type="submit" value="Login"> </td><td> <input type="reset" value="Clear"></td>
</tr>
</table
</form>
<?php
}
?>
</div>
</body>
</html>