Exemplo n.º 1
0
 public function does_form_validate($post)
 {
     if (fieldsEmpty($post)) {
         // fieldsEmpty() is a helper function, if it finds a blank...
         $this->error_message = "<p>ERROR:<br/>A field was left blank.</p>";
         return false;
         // return false to indicate this check failed
     } else {
         if ($post['password'] != $post['password2']) {
             // if the two submitted pw's don't match...
             $this->error_message = "<p>ERROR:<br/>The two passwords do not match.</p>";
             return false;
             // return false to indicate this check failed
         } else {
             if (!preg_match("/[A-Z+]/", $post['password']) or !preg_match("/[a-z+]/", $post['password']) or !preg_match("/[0-9+]/", $post['password']) or strlen($post['password']) < 6 or preg_match("/\\s/", $post['password'])) {
                 $this->error_message = "<p>ERROR:<br/>The format of the password is wrong.</p>";
                 return false;
                 // return false to indicate this check failed
             } else {
                 if (!preg_match("/^[a-zA-Z0-9._\\-+]+@[a-zA-Z0-9]+\\.[a-zA-Z]+\$/", $post['email']) and !preg_match("/^[a-zA-Z0-9._\\-+]+@[a-zA-Z0-9]+\\.[a-zA-Z0-9]+\\.[a-zA-Z]+\$/", $post['email'])) {
                     $this->error_message = "<p>ERROR:<br/>The format of the email is wrong.</p>";
                     return false;
                     // return false to indicate this check failed
                 } else {
                     return true;
                     // if everything passes, return true to indicate all these checks passed
                 }
             }
         }
     }
 }
Exemplo n.º 2
0
 public function login_fields_ok($post)
 {
     if (fieldsEmpty($post)) {
         // fieldsEmpty() is a helper function, if it finds a blank...
         $this->error_message = "<p>ERROR:<br/>A field was left blank.</p>";
         return false;
         // return false indicates that this check failed
     }
     return true;
     // else no blanks found, return true to indicate this check passed
 }
Exemplo n.º 3
0
        // sendLetter is a helper function.  It uses PHPMailer to send the email message.
        sendLetter($userEmail, $email_subject, $email_body);
        ?>
            </div>
<?php 
    } else {
        // else means the email address isn't in the database, so display error message.
        ?>
            <div id="form-response-message">    
                <p>ERROR:<br/>User Not Found.</p>
                <a href="reset">>> Reset Password</a>
            </div>
<?php 
        // display the reset password form
        //render('templates/reset-template');
    }
} else {
    if (isset($_POST['pw-reset-submit']) && fieldsEmpty($_POST)) {
        // if any fields are empty, alert user...
        ?>
        <div id="form-response-message">    
            <p>ERROR:<br/>A field was left blank.</p>
            <a href="reset">>> Reset Password</a>
        </div>
<?php 
        //render('templates/reset-template');     // and display the reset password form again
    } else {
        // else means no $_POST request, then just display the reset password form
        render('templates/reset-template');
    }
}