title: change password code error
body: <p>I've created a code to change a password. Now it seem contain an error.before i fill the form. 
  the page display the error message:</p>
  
  <blockquote>
    <p>Parse error: parse error, unexpected
    $end in C:\Program
    Files\xampp\htdocs\e-Complaint(FYP)\userChangePass.php
    on line 222</p>
  </blockquote>
  
  <p>this the code:</p>
  
  <pre><code>&lt;?php # userChangePass.php
  //this page allows logged in user to change their password.
  
  $page_title='Change Your Password';
  
  //if no first_name variable exists, redirect the user
  if(!isset($_SESSION['nameuser'])){
  
      header("Location: http://" .$_SERVER['HTTP_HOST']. dirname($_SERVER['PHP_SELF'])."/index.php");
      ob_end_clean();
      exit();
  
  }else{
  
      if(isset($_POST['submit'])) {//handle form.
          require_once('connectioncomplaint.php'); //connec to the database
  
          //check for a new password and match againts the confirmed password.
          if(eregi ("^[[:alnum:]]{4,20}$", stripslashes(trim($_POST['password1'])))){
              if($_POST['password1'] == $_POST['password2']){
                  $p =escape_data($_POST['password1']);
              }else{
                  $p=FALSE;
                  echo'&lt;p&gt;&lt;font color="red" size="+1"&gt; Your password did not match the confirmed password!&lt;/font&gt;&lt;/p&gt;';
              }
          }else{
              $p=FALSE;
              echo'&lt;p&gt;&lt;font color="red" size="+1"&gt; Please Enter a valid password!&lt;/font&gt;&lt;/p&gt;';
          }
  
          if($p){ //if everything OK.
  
              //make the query
              $query="UPDATE access SET password=PASSWORD('$p') WHERE userid={$_SESSION['userid']}";
              $result=@mysql_query($query);//run the query.
              if(mysql_affected_rows() == 1) {//if it run ok.
  
                  //send an email,if desired.
                  echo '&lt;p&gt;&lt;b&gt;your password has been changed.&lt;/b&gt;&lt;/p&gt;';
                  //include('templates/footer.inc');//include the HTML footer.
                  exit();
  
              }else{//if it did not run ok
  
              $message= '&lt;p&gt;Your password could not be change due to a system error.We apolpgize for any inconvenience.&lt;/p&gt;&lt;p&gt;' .mysql_error() .'&lt;/p&gt;';
  
              }
              mysql_close();//close the database connection.
  
              }else{//failed the validation test.
                  echo '&lt;p&gt;&lt;font color="red" size="+1"&gt; Please try again.&lt;/font&gt;&lt;/p&gt;';
              }
          }//end of the main Submit conditional.
      ?&gt;
  </code></pre>
  
  <p>And code for form:</p>
  
  <pre><code>&lt;h1&gt;Change Your Password&lt;/h1&gt;
        &lt;form action="&lt;?php echo $_SERVER['PHP_SELF']; ?&gt;" method="post"&gt;
        &lt;fieldset&gt;
        &lt;p&gt;&lt;b&gt;New Password:&lt;/b&gt;&lt;input type="password" name="password1" size="20" maxlength="20" /&gt;
        &lt;small&gt;Use only letters and numbers.Must be between 4 and 20 characters long.&lt;/small&gt;&lt;/p&gt;
        &lt;p&gt;&lt;b&gt;Confirm New Password:&lt;/b&gt;&lt;input type="password" name="password2" size="20" maxlength="20" /&gt;&lt;/p&gt;
        &lt;/fieldset&gt;
        &lt;div align="center"&gt; &lt;input type="submit" name="submit" value="Change My Password" /&gt;&lt;/div&gt;
  
  &lt;/form&gt;&lt;!--End Form--&gt;
  </code></pre>