php validation help to match email and password

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ms115
    New Member
    • Nov 2006
    • 2

    php validation help to match email and password

    Code:
    <?php
    
    if (isset($_POST['submit'])){
        $error = array()
    
    
    if (empty($_POST['mail'])) {
            $error[] = 'Please Enter your Email and also confirm your mail';
        } else {
    
    
            if (preg_match("/^([a-zA-Z0-9])+([a-zA-Z0-9\._-])*@([a-zA-Z0-9_-])+([a-zA-Z0-9\._-]+)+$/", $_POST['mail'])) {
                $Email = $_POST['mail'];
            } else {
                 $error[] = 'Your Email Address is Invalid  ';
            }
    
        }
    
    if (empty($_POST['pass'])) {
            $error[] = 'Please Enter your password';
        } else {
    
            if (preg_match("/^[- a-z0-9,<>@()&\%$#!~`]{5,9}$/i", $_POST['pass'])) {
          
                $Password1 = $_POST['pass'];
            } else {
                 $error[] = 'Your password must be between 5 and 9 characters';
           
    		} else {
    
    			if ($Password1!=$conpass trim($_POST['conpass']){
    		
    		$error[] = 'Your passwords do not match';
    
        }
    
    	}
    
    ?>
    
    <form action= "" >
    <table>
    <tr>
        <td width="117">Password</td>
        <td width="237"><input type="password" name="pass" size="18">*</td>
        <td width="120">Confirm Password</td>``
        <td width="241">
    	<input type="password" name="conpass" size="18"></td>
        <td width="25">&nbsp;</td>
        <td width="38">&nbsp;</td>
      </tr>
    </table>
    </form>
    Last edited by Rabbit; Dec 16 '15, 05:19 PM. Reason: Please use [code] and [/code] tags when posting code or formatted data.
Working...