Parse error: syntax error, unexpected '{' in E:\FYP\DB\TWAMPd\htdocs\web\edit_infos.php on line 58
I can't update the information page . Can someone help me?
<?php
include('config.php');
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="<?php echo $design; ?>/style.css" rel="stylesheet" title="Style" />
<style type="text/css">
.message {
text-align: center;
}
</style>
<title>Edit my personnal informations</title>
</head>
<body>
<div class="header">
<a href="<?php echo $url_home; ?>"><img src="<?php echo $design; ?>/images/logo.png" alt="Members Area" /></a>
</div>
<?php
//We check if the user is logged
if(isset($_SESSION['m_ac']))
{
//We check if the form has been sent
if(isset($_POST['m_ac'], $_POST['m_pw'], $_POST['passverif'], $_POST['m_email']))
{
//We remove slashes depending on the configuration
if(get_magic_quotes_gpc())
{
$_POST['m_ac'] = stripslashes($_POST['m_ac']);
$_POST['m_pw'] = stripslashes($_POST['m_pw']);
$_POST['passverif'] = stripslashes($_POST['passverif']);
$_POST['m_fn'] = stripslashes($_POST['m_fn']);
$_POST['m_sn'] = stripslashes($_POST['m_sn']);
$_POST['m_question'] = stripslashes($_POST['m_question']);
$_POST['m_answer'] = stripslashes($_POST['m_answer']);
$_POST['m_tel'] = stripslashes($_POST['m_tel']);
$_POST['m_address'] = stripslashes($_POST['m_address']);
$_POST['m_email'] = stripslashes($_POST['m_email']);
}
//We check if the two passwords are identical
if($_POST['m_pw']==$_POST['passverif'])
{
//We check if the m_pw has 6 or more characters
if(strlen($_POST['m_pw'])>=6)
{
//We check if the m_email form is valid
if(preg_match('#^(([a-z0-9!\#$%&\\\'*+/=?^_`{|}~-]+\.?)*[a-z0-9!\#$%&\\\'*+/=?^_`{|}~-]+)@(([a-z0-9-_]+\.?)*[a-z0-9-_]+)\.[a-z]{2,}$#i',$_POST['m_email']))
{
//We protect the variables
$m_ac = mysql_real_escape_string($_POST['m_ac']);
$m_pw = mysql_real_escape_string($_POST['m_pw']);
$m_email = mysql_real_escape_string($_POST['m_email']);
//We check if there is no other user using the same m_ac
$dn = mysql_fetch_array(mysql_query('select count(*) as nb from users where m_ac="'.$m_ac.'"'));
//We check if the m_ac changed and if it is available
if($dn['nb']==0 or $_POST['m_ac']==$_SESSION['m_ac'])
{
//We edit the user informations
if(mysql_query('update users set m_ac="'.$m_ac.'", m_pw="'.$m_pw.'", m_email="'.$m_email.'",where m_id="'.mysql_real_escape_string($_SESSION['userid']).'"'))
line 58: {
//We dont display the form
$form = false;
//We delete the old sessions so the user need to log again
unset($_SESSION['m_ac']);
?>
<div class="message">
<p>Your informations have successfuly been updated. You need to log again.</p>
<p><br />
<a href="connexion.php">Log in</a></p>
</div>
<?php
}
else
{
//Otherwise, we say that an error occured
$form = true;
$message = 'An error occurred while updating your informations.';
}
}
else
{
//Otherwise, we say the m_ac is not available
$form = true;
$message = 'The account you want to use is not available, please choose another one.';
}
}
else
{
//Otherwise, we say the m_email is not valid
$form = true;
$message = 'The email you entered is not valid.';
}
}
else
{
//Otherwise, we say the m_pw is too short
$form = true;
$message = 'Your passwork must contain at least 6 characters.';
}
}
else
{
//Otherwise, we say the passwords are not identical
$form = true;
$message = 'The passwords you entered are not identical.';
}
}
else
{
$form = true;
}
if($form)
{
//We display a message if necessary
if(isset($message))
{
echo '<strong>'.$message.'</strong>';
}
//If the form has already been sent, we display the same values
if(isset($_POST['m_ac'],$_POST['m_pw'],$_POST['m_email']))
{
$pseudo = htmlentities($_POST['m_ac'], ENT_QUOTES, 'UTF-8');
if($_POST['m_pw']==$_POST['passverif'])
{
$m_pw = htmlentities($_POST['m_pw'], ENT_QUOTES, 'UTF-8');
}
else
{
$m_pw = '';
}
$m_email = htmlentities($_POST['m_email'], ENT_QUOTES, 'UTF-8');
}
else
{
//otherwise, we display the values of the database
$dnn = mysql_fetch_array(mysql_query('select m_ac,m_pw,m_email from member where m_ac="'.$_SESSION['m_ac'].'"'));
$m_ac = htmlentities($dnn['m_ac'], ENT_QUOTES, 'UTF-8');
$m_pw = htmlentities($dnn['m_pw'], ENT_QUOTES, 'UTF-8');
$m_email = htmlentities($dnn['m_email'], ENT_QUOTES, 'UTF-8');
}
//We display the form
?>
<div class="content">
<form action="edit_infos.php" method="post">
You can edit your informations:<br />
<div class="center">
<label for="m_pw">Password<span class="small">(6 characters min.)</span></label><input type="m_pw" name="m_pw" m_id="m_pw" value="<?php echo $m_pw; ?>" /><br />
<br />
<label for="passverif">Comfirm<span class="small">(verification)</span></label><input type="m_pw" name="passverif" m_id="passverif" value="<?php echo $m_pw; ?>" /><br />
<br />
<label for="m_fn">Your firstname</label><input type="text" name="m_fn" m_id="m_fn" value="<?php echo $m_fn; ?>" /><br />
<br />
<label for="m_sn">Your Second</label><input type="text" name="m_sn" m_id="m_sn" value="<?php echo $m_sn; ?>" /><br />
<br />
<label for="m_question">Reset Question</label><input type="text" name="m_question" m_id="m_question" value="<?php echo $m_question; ?>" /><br />
<br />
<label for="m_answer">Reset Answer</label><input type="text" name="m_answer" m_id="m_answer" value="<?php echo $m_answer; ?>" /><br />
<br />
<label for="m_tel">Your Number</label><input type="text" name="m_tel" m_id="m_tel" value="<?php echo $m_tel; ?>" /><br />
<br />
<label for="m_address">Your address</label><input type="text" name="m_address" m_id="m_address" value="<?php echo $m_address; ?>" /><br />
<br />
<label for="m_email">Your email</label><input type="text" name="m_email" m_id="m_email" value="<?php echo $m_email; ?>" /><br />
<br />
<input type="submit" value="Send" />
</div>
</form>
</div>
<?php
}
}
else
{
?>
<div class="message">
<p><span class="message">To access this page, you must be logged.</span></p>
<p><br />
<a href="connexion.php">Log in</a></p>
</div>
<?php
}
?>
</html>