Validate form forgotpass

Discussion in 'PHP' started by web@master24, Jul 27, 2009.

  1. #1
    HI im have this form:

    <?
    include("includes/session.php");
    include("templates/header.php");
    include("templates/header_sub.php");
    ?>
    
    <table align="center" border="0" width="728">
    	<tr>
    		<td valign="top"><p><br>
    <?
    /**
     * Forgot Password form has been submitted and no errors
     * were found with the form (the username is in the database)
     */
    if(isset($_SESSION['forgotpass'])){
       /**
        * New password was generated for user and sent to user's
        * email address.
        */
       if($_SESSION['forgotpass']){
          echo "<h3>New Password Generated</h3>";
          echo "<p>Your new password has been generated "
              ."and sent to the email <br>associated with your account. "
              ."<a href=\"main.php\">Main</a>.</p></td></tr></table>";
       }
       /**
        * Email could not be sent, therefore password was not
        * edited in the database.
        */
       else{
          echo "<h3>New Password Failure</h3>";
          echo "<p>There was an error sending you the "
              ."email with the new password,<br> so your password has not been changed. "
              ."<a href=\"main.php\">Main</a>.</p></td></tr></table>";
       }
           
       unset($_SESSION['forgotpass']);
    }
    else{
    
    /**
     * Forgot password form is displayed, if error found
     * it is displayed.
     */
    ?>
    
    
    <h3>Recupere su contrase&#241;a</h3>
    Porfavor ingrese su Username y su correo electronico con el que se registro en MiMp3.net, posteriormente de 1 a 10 minutos recibira su password. Recuerde verificar en la bandeja de basura o spam.<br><br>
    <? echo $form->error("email"); ?>
    <form action="process.php" method="POST">
    <div style="width:100px;float:left;"><b>Username:</b></div> <input style="float:left;" type="text" name="user" maxlength="30" value="<? echo $form->value("user"); ?>"><div style="clear:both;"></div>
    <div style="width:100px;float:left;"><b>Email:</b></div> <input style="float:left;" type="text" name="email" maxlength="30" value="<? echo $form->value("email"); ?>"><div style="clear:both;"></div>
    <input type="hidden" name="subforgot" value="1">
    <input type="submit" value="Get New Password">
    </form>
    
    </td><td width="310" align="center" valign="top">
       <?=$ads['box_ad'];?></td></tr></table>
    
    <?
    }
    ?>
    <?
    include("templates/footer.php");
    ?>
    </body>
    </html>
    
    PHP:
    I want what the users cant ask for pass if the email account is yahoo, the file what process the form is:

    <?
    include("includes/session.php");
    
    class Process
    {
       /* Class constructor */
       function Process(){
          global $session;
          /* User submitted login form */
          if(isset($_POST['sublogin'])){
             $this->procLogin();
          }
          /* User submitted registration form */
          else if(isset($_POST['subjoin'])){
             $this->procRegister();
          }
          /* User submitted forgot password form */
          else if(isset($_POST['subforgot'])){
             $this->procForgotPass();
          }
          /* User submitted edit account form */
          else if(isset($_POST['subedit'])){
             $this->procEditAccount();
          }
          /**
           * The only other reason user should be directed here
           * is if he wants to logout, which means user is
           * logged in currently.
           */
          else if($session->logged_in){
             $this->procLogout();
          }
          /**
           * Should not get here, which means user is viewing this page
           * by mistake and therefore is redirected.
           */
           else{
              header("Location: main.php");
           }
       }
    
       /**
        * procLogin - Processes the user submitted login form, if errors
        * are found, the user is redirected to correct the information,
        * if not, the user is effectively logged in to the system.
        */
       function procLogin(){
          global $session, $form;
          /* Login attempt */
          $retval = $session->login($_POST['user'], $_POST['pass'], isset($_POST['remember']));
         
          /* Login successful */
          if($retval){
             header("Location: ".$session->referrer);
          }
          /* Login failed */
          else{
             $_SESSION['value_array'] = $_POST;
             $_SESSION['error_array'] = $form->getErrorArray();
             header("Location: ".$session->referrer);
          }
       }
       
       /**
        * procLogout - Simply attempts to log the user out of the system
        * given that there is no logout form to process.
        */
       function procLogout(){
          global $session;
          $retval = $session->logout();
          header("Location: main.php");
       }
       
       /**
        * procRegister - Processes the user submitted registration form,
        * if errors are found, the user is redirected to correct the
        * information, if not, the user is effectively registered with
        * the system and an email is (optionally) sent to the newly
        * created user.
        */
       function procRegister(){
          global $session, $form, $mailer;
          /* Convert username to all lowercase (by option) */
       //   if(ALL_LOWERCASE){
      $_POST['user'] = strtolower($_POST['user']);       
      //    }
          /* Registration attempt */
    //      $retval = $session->register($_POST['user'], $_POST['pass'], $_POST['email']);
    
    
    $result = mysql_query("SELECT COUNT(*) FROM users WHERE username = '".$_POST['user']."'")
    or die(mysql_error());
    $row = mysql_fetch_array( $result );
    if($row[0]==0){
        $retval=0;
    }else{
        $retval=2;
    }
    
    //if(!isset($_POST['user'])||!isset($_POST['pass'])||!isset($_POST['email'])){
    //  $retval=1;
    //  } else
    
    if(strlen($_POST[user])<3){
      $retval=3;   
        }   
    
    if(strlen($_POST[pass])<6){
      $retval=4;
      }
    
    $email = $_POST['email'];
    $email = mysql_real_escape_string($email);
    if (eregi("@yahoo", $email))
    {
    $retval = 5;
    }
    
     
    if($retval==0){
    mysql_query("INSERT INTO users (`username`,`password`,`userid`,`userlevel`,`email`,`timestamp`)
     VALUES('".$_POST['user']."', '".md5($_POST['pass'])."','".md5($_POST['user'])."','1','".$_POST['email']."',NOW() ) ")
    or die(mysql_error());
    }
    
          /* Registration Successful */
          if($retval == 0){
             $_SESSION['reguname'] = $_POST['user'];
             $_SESSION['regsuccess'] = true;
             $mailer->sendWelcome($_POST['user'],$_POST['email'],$_POST['pass']);
             header("Location: ".$session->referrer);
          }
          /* Error found with form */
          else if($retval == 1){
             $_SESSION['value_array'] = $_POST;
             $_SESSION['error_array'] = "Please fill in all data.";
             header("Location: ".$session->referrer);
          }
          /* Registration attempt failed */
          else if($retval == 2){
             $_SESSION['reguname'] = $_POST['user'];
             $_SESSION['regsuccess'] = false;
             header("Location: ".$session->referrer);
          }
          /* Registration attempt failed */
          else if($retval == 3){
             $_SESSION['reguname'] = $_POST['user'];
            // $_SESSION['regsuccess'] = false;
             header("Location: ".$session->referrer."?error=Error: Please Make Sure Username is 3 characters or more.");
          }
          /* Registration attempt failed */
          else if($retval == 4){
             $_SESSION['reguname'] = $_POST['user'];
            // $_SESSION['regsuccess'] = false;
             header("Location: ".$session->referrer."?error=Error: Please Make Sure Password is 6 characters or more.");
          }
          else if ($retval == 5){
          $_SESSION['reguname'] = $_POST['user'];
            // $_SESSION['regsuccess'] = false;
             header("Location: ".$session->referrer."?error=Error: Please Make Sure E-mail is not a Yahoo account");
          }
          
       }
       
       /**
        * procForgotPass - Validates the given username then if
        * everything is fine, a new password is generated and
        * emailed to the address the user gave on sign up.
        */
       
       function procForgotPass(){
          global $database, $session, $mailer, $form;
          /* Username error checking */
          $subuser = $_POST['user'];
          $field = "user";  //Use field name for username
          if(!$subuser || strlen($subuser = trim($subuser)) == 0){
             $form->setError($field, "* Username not entered<br>");
          }
          else{
             /* Make sure username is in database */
             $subuser = stripslashes($subuser);
             if(strlen($subuser) < 3 || strlen($subuser) > 30 ||
                !eregi("^([0-9a-z_-])+$", $subuser) ||
                (!$database->usernameTaken($subuser))){
                $form->setError($field, "* Username does not exist<br>");
             }
          }
         
         /* Get email of user */
         $usrinf = $database->getUserInfo($subuser);
         $email  = $usrinf['email'];
         if($_POST['email']!=$email){
            $form->setError('email', "* Email does not match<br>");     
         }
          /* Errors exist, have user correct them */
          if($form->num_errors > 0){
             $_SESSION['value_array'] = $_POST;
             $_SESSION['error_array'] = $form->getErrorArray();
          }
          /* Generate new password and email it to user */
          else{
             /* Generate new password */
             $newpass = $session->generateRandStr(8);
             
    
             /* Attempt to send the email with new password */
             if($mailer->sendNewPass($subuser,$email,$newpass)){
                /* Email sent, update database */
                $database->updateUserField($subuser, "password", md5($newpass));
                $_SESSION['forgotpass'] = true;
             }
             /* Email failure, do not change password */
             else{
                $_SESSION['forgotpass'] = false;
             }
          }
         
          header("Location: ".$session->referrer);
       }
       
       
       
       /**
        * procEditAccount - Attempts to edit the user's account
        * information, including the password, which must be verified
        * before a change is made.
        */
       function procEditAccount(){
          global $session, $form;
          /* Account edit attempt */
          $retval = $session->editAccount($_POST['curpass'], $_POST['newpass'], $_POST['email']);
    
          /* Account edit successful */
          if($retval){
             $_SESSION['useredit'] = true;
             header("Location: ".$session->referrer);
          }
          /* Error found with form */
          else{
             $_SESSION['value_array'] = $_POST;
             $_SESSION['error_array'] = $form->getErrorArray();
             header("Location: ".$session->referrer);
          }
       }
    };
    
    /* Initialize process */
    $process = new Process;
    
    ?>
    PHP:
    I hope somebody can helpme
     
    web@master24, Jul 27, 2009 IP
  2. SHOwnsYou

    SHOwnsYou Peon

    Messages:
    209
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #2
    
         $usrinf = $database->getUserInfo($subuser);
         $email  = $usrinf['email'];
         if($_POST['email']!=$email){
            $form->setError('email', "* Email does not match<br>");     
         }
    //new part
           if(eregi("@yahoo", $email){
           $form->setError('email', "*Cannot use Yahoo emails<br />");
         }
    
    PHP:
     
    SHOwnsYou, Jul 27, 2009 IP
  3. web@master24

    web@master24 Active Member

    Messages:
    418
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    90
    #3
    Im add the code, now the code of process.php is:

    <?
    include("includes/session.php");
    
    class Process
    {
       /* Class constructor */
       function Process(){
          global $session;
          /* User submitted login form */
          if(isset($_POST['sublogin'])){
             $this->procLogin();
          }
          /* User submitted registration form */
          else if(isset($_POST['subjoin'])){
             $this->procRegister();
          }
          /* User submitted forgot password form */
          else if(isset($_POST['subforgot'])){
             $this->procForgotPass();
          }
          /* User submitted edit account form */
          else if(isset($_POST['subedit'])){
             $this->procEditAccount();
          }
          /**
           * The only other reason user should be directed here
           * is if he wants to logout, which means user is
           * logged in currently.
           */
          else if($session->logged_in){
             $this->procLogout();
          }
          /**
           * Should not get here, which means user is viewing this page
           * by mistake and therefore is redirected.
           */
           else{
              header("Location: main.php");
           }
       }
    
       /**
        * procLogin - Processes the user submitted login form, if errors
        * are found, the user is redirected to correct the information,
        * if not, the user is effectively logged in to the system.
        */
       function procLogin(){
          global $session, $form;
          /* Login attempt */
          $retval = $session->login($_POST['user'], $_POST['pass'], isset($_POST['remember']));
         
          /* Login successful */
          if($retval){
             header("Location: ".$session->referrer);
          }
          /* Login failed */
          else{
             $_SESSION['value_array'] = $_POST;
             $_SESSION['error_array'] = $form->getErrorArray();
             header("Location: ".$session->referrer);
          }
       }
       
       /**
        * procLogout - Simply attempts to log the user out of the system
        * given that there is no logout form to process.
        */
       function procLogout(){
          global $session;
          $retval = $session->logout();
          header("Location: main.php");
       }
       
       /**
        * procRegister - Processes the user submitted registration form,
        * if errors are found, the user is redirected to correct the
        * information, if not, the user is effectively registered with
        * the system and an email is (optionally) sent to the newly
        * created user.
        */
       function procRegister(){
          global $session, $form, $mailer;
          /* Convert username to all lowercase (by option) */
       //   if(ALL_LOWERCASE){
      $_POST['user'] = strtolower($_POST['user']);       
      //    }
          /* Registration attempt */
    //      $retval = $session->register($_POST['user'], $_POST['pass'], $_POST['email']);
    
    
    $result = mysql_query("SELECT COUNT(*) FROM users WHERE username = '".$_POST['user']."'")
    or die(mysql_error());
    $row = mysql_fetch_array( $result );
    if($row[0]==0){
        $retval=0;
    }else{
        $retval=2;
    }
    
    //if(!isset($_POST['user'])||!isset($_POST['pass'])||!isset($_POST['email'])){
    //  $retval=1;
    //  } else
    
    if(strlen($_POST[user])<3){
      $retval=3;   
        }   
    
    if(strlen($_POST[pass])<6){
      $retval=4;
      }
    
    $email = $_POST['email'];
    $email = mysql_real_escape_string($email);
    if (eregi("@yahoo", $email))
    {
    $retval = 5;
    }
    
     
    if($retval==0){
    mysql_query("INSERT INTO users (`username`,`password`,`userid`,`userlevel`,`email`,`timestamp`)
     VALUES('".$_POST['user']."', '".md5($_POST['pass'])."','".md5($_POST['user'])."','1','".$_POST['email']."',NOW() ) ")
    or die(mysql_error());
    }
    
          /* Registration Successful */
          if($retval == 0){
             $_SESSION['reguname'] = $_POST['user'];
             $_SESSION['regsuccess'] = true;
             $mailer->sendWelcome($_POST['user'],$_POST['email'],$_POST['pass']);
             header("Location: ".$session->referrer);
          }
          /* Error found with form */
          else if($retval == 1){
             $_SESSION['value_array'] = $_POST;
             $_SESSION['error_array'] = "Please fill in all data.";
             header("Location: ".$session->referrer);
          }
          /* Registration attempt failed */
          else if($retval == 2){
             $_SESSION['reguname'] = $_POST['user'];
             $_SESSION['regsuccess'] = false;
             header("Location: ".$session->referrer);
          }
          /* Registration attempt failed */
          else if($retval == 3){
             $_SESSION['reguname'] = $_POST['user'];
            // $_SESSION['regsuccess'] = false;
             header("Location: ".$session->referrer."?error=Error: Please Make Sure Username is 3 characters or more.");
          }
          /* Registration attempt failed */
          else if($retval == 4){
             $_SESSION['reguname'] = $_POST['user'];
            // $_SESSION['regsuccess'] = false;
             header("Location: ".$session->referrer."?error=Error: Please Make Sure Password is 6 characters or more.");
          }
          else if ($retval == 5){
          $_SESSION['reguname'] = $_POST['user'];
            // $_SESSION['regsuccess'] = false;
             header("Location: ".$session->referrer."?error=Error: Please Make Sure E-mail is not a Yahoo account");
          }
          
       }
       
       /**
        * procForgotPass - Validates the given username then if
        * everything is fine, a new password is generated and
        * emailed to the address the user gave on sign up.
        */
       
       function procForgotPass(){
          global $database, $session, $mailer, $form;
          /* Username error checking */
          $subuser = $_POST['user'];
          $field = "user";  //Use field name for username
          if(!$subuser || strlen($subuser = trim($subuser)) == 0){
             $form->setError($field, "* Username not entered<br>");
          }
          else{
             /* Make sure username is in database */
             $subuser = stripslashes($subuser);
             if(strlen($subuser) < 3 || strlen($subuser) > 30 ||
                !eregi("^([0-9a-z_-])+$", $subuser) ||
                (!$database->usernameTaken($subuser))){
                $form->setError($field, "* Username does not exist<br>");
             }
          }
         
         /* Get email of user */
         $usrinf = $database->getUserInfo($subuser);
         $email  = $usrinf['email'];
         if($_POST['email']!=$email){
            $form->setError('email', "* Email does not match<br>");     
         }
     if(eregi("@yahoo", $email)
    }
           $form->setError('email', "*Tu cuenta es de YAHOO, porfavor envie un email a webmaster@mimp3.net para recuperar tu password / Your account is YAHOO, please send an email to webmaster@mimp3.net for recovery your pass<br />");
         }
          /* Errors exist, have user correct them */
          if($form->num_errors > 0){
             $_SESSION['value_array'] = $_POST;
             $_SESSION['error_array'] = $form->getErrorArray();
          }
          /* Generate new password and email it to user */
          else{
             /* Generate new password */
             $newpass = $session->generateRandStr(8);
             
    
             /* Attempt to send the email with new password */
             if($mailer->sendNewPass($subuser,$email,$newpass)){
                /* Email sent, update database */
                $database->updateUserField($subuser, "password", md5($newpass));
                $_SESSION['forgotpass'] = true;
             }
             /* Email failure, do not change password */
             else{
                $_SESSION['forgotpass'] = false;
             }
          }
         
          header("Location: ".$session->referrer);
       }
       
       
       
       /**
        * procEditAccount - Attempts to edit the user's account
        * information, including the password, which must be verified
        * before a change is made.
        */
       function procEditAccount(){
          global $session, $form;
          /* Account edit attempt */
          $retval = $session->editAccount($_POST['curpass'], $_POST['newpass'], $_POST['email']);
    
          /* Account edit successful */
          if($retval){
             $_SESSION['useredit'] = true;
             header("Location: ".$session->referrer);
          }
          /* Error found with form */
          else{
             $_SESSION['value_array'] = $_POST;
             $_SESSION['error_array'] = $form->getErrorArray();
             header("Location: ".$session->referrer);
          }
       }
    };
    
    /* Initialize process */
    $process = new Process;
    
    ?>
    PHP:
    But is showing me this error:


    Parse error: syntax error, unexpected '}' in /home/xxxxx/domains/xxxxxxxx/public_html/demo/process.php on line 196
     
    web@master24, Jul 27, 2009 IP
  4. SHOwnsYou

    SHOwnsYou Peon

    Messages:
    209
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #4
    try using this:
    
    <?
    include("includes/session.php");
    
    class Process
    {
       /* Class constructor */
       function Process(){
          global $session;
          /* User submitted login form */
          if(isset($_POST['sublogin'])){
             $this->procLogin();
          }
          /* User submitted registration form */
          else if(isset($_POST['subjoin'])){
             $this->procRegister();
          }
          /* User submitted forgot password form */
          else if(isset($_POST['subforgot'])){
             $this->procForgotPass();
          }
          /* User submitted edit account form */
          else if(isset($_POST['subedit'])){
             $this->procEditAccount();
          }
          /**
           * The only other reason user should be directed here
           * is if he wants to logout, which means user is
           * logged in currently.
           */
          else if($session->logged_in){
             $this->procLogout();
          }
          /**
           * Should not get here, which means user is viewing this page
           * by mistake and therefore is redirected.
           */
           else{
              header("Location: main.php");
           }
       }
    
       /**
        * procLogin - Processes the user submitted login form, if errors
        * are found, the user is redirected to correct the information,
        * if not, the user is effectively logged in to the system.
        */
       function procLogin(){
          global $session, $form;
          /* Login attempt */
          $retval = $session->login($_POST['user'], $_POST['pass'], isset($_POST['remember']));
         
          /* Login successful */
          if($retval){
             header("Location: ".$session->referrer);
          }
          /* Login failed */
          else{
             $_SESSION['value_array'] = $_POST;
             $_SESSION['error_array'] = $form->getErrorArray();
             header("Location: ".$session->referrer);
          }
       }
       
       /**
        * procLogout - Simply attempts to log the user out of the system
        * given that there is no logout form to process.
        */
       function procLogout(){
          global $session;
          $retval = $session->logout();
          header("Location: main.php");
       }
       
       /**
        * procRegister - Processes the user submitted registration form,
        * if errors are found, the user is redirected to correct the
        * information, if not, the user is effectively registered with
        * the system and an email is (optionally) sent to the newly
        * created user.
        */
       function procRegister(){
          global $session, $form, $mailer;
          /* Convert username to all lowercase (by option) */
       //   if(ALL_LOWERCASE){
      $_POST['user'] = strtolower($_POST['user']);       
      //    }
          /* Registration attempt */
    //      $retval = $session->register($_POST['user'], $_POST['pass'], $_POST['email']);
    
    
    $result = mysql_query("SELECT COUNT(*) FROM users WHERE username = '".$_POST['user']."'")
    or die(mysql_error());
    $row = mysql_fetch_array( $result );
    if($row[0]==0){
        $retval=0;
    }else{
        $retval=2;
    }
    
    //if(!isset($_POST['user'])||!isset($_POST['pass'])||!isset($_POST['email'])){
    //  $retval=1;
    //  } else
    
    if(strlen($_POST[user])<3){
      $retval=3;   
        }   
    
    if(strlen($_POST[pass])<6){
      $retval=4;
      }
    
    $email = $_POST['email'];
    $email = mysql_real_escape_string($email);
    if (eregi("@yahoo", $email))
    {
    $retval = 5;
    }
    
     
    if($retval==0){
    mysql_query("INSERT INTO users (`username`,`password`,`userid`,`userlevel`,`email`,`timestamp`)
     VALUES('".$_POST['user']."', '".md5($_POST['pass'])."','".md5($_POST['user'])."','1','".$_POST['email']."',NOW() ) ")
    or die(mysql_error());
    }
    
          /* Registration Successful */
          if($retval == 0){
             $_SESSION['reguname'] = $_POST['user'];
             $_SESSION['regsuccess'] = true;
             $mailer->sendWelcome($_POST['user'],$_POST['email'],$_POST['pass']);
             header("Location: ".$session->referrer);
          }
          /* Error found with form */
          else if($retval == 1){
             $_SESSION['value_array'] = $_POST;
             $_SESSION['error_array'] = "Please fill in all data.";
             header("Location: ".$session->referrer);
          }
          /* Registration attempt failed */
          else if($retval == 2){
             $_SESSION['reguname'] = $_POST['user'];
             $_SESSION['regsuccess'] = false;
             header("Location: ".$session->referrer);
          }
          /* Registration attempt failed */
          else if($retval == 3){
             $_SESSION['reguname'] = $_POST['user'];
            // $_SESSION['regsuccess'] = false;
             header("Location: ".$session->referrer."?error=Error: Please Make Sure Username is 3 characters or more.");
          }
          /* Registration attempt failed */
          else if($retval == 4){
             $_SESSION['reguname'] = $_POST['user'];
            // $_SESSION['regsuccess'] = false;
             header("Location: ".$session->referrer."?error=Error: Please Make Sure Password is 6 characters or more.");
          }
          else if ($retval == 5){
          $_SESSION['reguname'] = $_POST['user'];
            // $_SESSION['regsuccess'] = false;
             header("Location: ".$session->referrer."?error=Error: Please Make Sure E-mail is not a Yahoo account");
          }
         
       }
       
       /**
        * procForgotPass - Validates the given username then if
        * everything is fine, a new password is generated and
        * emailed to the address the user gave on sign up.
        */
       
       function procForgotPass(){
          global $database, $session, $mailer, $form;
          /* Username error checking */
          $subuser = $_POST['user'];
          $field = "user";  //Use field name for username
          if(!$subuser || strlen($subuser = trim($subuser)) == 0){
             $form->setError($field, "* Username not entered<br>");
          }
          else{
             /* Make sure username is in database */
             $subuser = stripslashes($subuser);
             if(strlen($subuser) < 3 || strlen($subuser) > 30 ||
                !eregi("^([0-9a-z_-])+$", $subuser) ||
                (!$database->usernameTaken($subuser))){
                $form->setError($field, "* Username does not exist<br>");
             }
          }
         
         /* Get email of user */
         $usrinf = $database->getUserInfo($subuser);
         $email  = $usrinf['email'];
         if($_POST['email']!=$email){
            $form->setError('email', "* Email does not match<br>");     
         }
     if(eregi("@yahoo", $email){
           $form->setError('email', "*Tu cuenta es de YAHOO, porfavor envie un email a webmaster@mimp3.net para recuperar tu password / Your account is YAHOO, please send an email to webmaster@mimp3.net for recovery your pass<br />");
         }
          /* Errors exist, have user correct them */
          if($form->num_errors > 0){
             $_SESSION['value_array'] = $_POST;
             $_SESSION['error_array'] = $form->getErrorArray();
          }
          /* Generate new password and email it to user */
          else{
             /* Generate new password */
             $newpass = $session->generateRandStr(8);
             
    
             /* Attempt to send the email with new password */
             if($mailer->sendNewPass($subuser,$email,$newpass)){
                /* Email sent, update database */
                $database->updateUserField($subuser, "password", md5($newpass));
                $_SESSION['forgotpass'] = true;
             }
             /* Email failure, do not change password */
             else{
                $_SESSION['forgotpass'] = false;
             }
          }
         
          header("Location: ".$session->referrer);
       }
       
       
       
       /**
        * procEditAccount - Attempts to edit the user's account
        * information, including the password, which must be verified
        * before a change is made.
        */
       function procEditAccount(){
          global $session, $form;
          /* Account edit attempt */
          $retval = $session->editAccount($_POST['curpass'], $_POST['newpass'], $_POST['email']);
    
          /* Account edit successful */
          if($retval){
             $_SESSION['useredit'] = true;
             header("Location: ".$session->referrer);
          }
          /* Error found with form */
          else{
             $_SESSION['value_array'] = $_POST;
             $_SESSION['error_array'] = $form->getErrorArray();
             header("Location: ".$session->referrer);
          }
       }
    };
    
    /* Initialize process */
    $process = new Process;
    
    ?>
    
    PHP:
     
    SHOwnsYou, Jul 27, 2009 IP
  5. web@master24

    web@master24 Active Member

    Messages:
    418
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    90
    #5
    Show te same error
     
    web@master24, Jul 27, 2009 IP