Guest User

Untitled

a guest
Jul 5th, 2016
251
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.93 KB | None | 0 0
  1. <?php
  2.     error_reporting(0);
  3.     session_start();
  4.     // var_dump($_SESSION);
  5.     include("include/conn.php");
  6.     if(isset($_POST['login'])){
  7.         $email =  mysqli_real_escape_string($conn,trim($_POST['email']));
  8.         // $pwd = md5($_POST['pwd']);
  9.         $pwd = mysqli_real_escape_string($conn,MD5($_POST['pwd']));
  10.         $error =array();
  11.         if(empty($email)){
  12.             $error['email']="Enter Your Email";
  13.             }elseif(!filter_var($email,FILTER_VALIDATE_EMAIL)){
  14.             $error['email']="Enter valid Email";
  15.         }
  16.         if(empty($pwd)){
  17.             $error['pwd']="Enter Your Password";
  18.         }
  19.         // echo "<pre>";
  20.         // var_dump($error);
  21.         // echo "</pre>";
  22.         $errorcount=count($error);
  23.         if($errorcount==0){        
  24.             $login="select fnm,lnm,email,addr,age,dob from register where email='$email' and pwd='$pwd' and status='a'";
  25.             echo $login;
  26.             $exe=mysqli_query($conn,$login) or die(mysqli_error($conn));
  27.             if($exe){
  28.                 $num=mysqli_num_rows($exe);
  29.                 if($num==1){
  30.                     $_SESSION['email']=$email;                 
  31.                     header("location:index.php");
  32.                     }else{
  33.                     $error['err']="Email Or password Incorrect";
  34.                 }
  35.             }
  36.         }
  37.     }
  38.    
  39.    
  40. ?>
  41.  
  42. <style>
  43.     span.error{
  44.    
  45.     color:red;
  46.     margin-left:10px;
  47.     }
  48. </style>
  49. <div style='text-align:center;'>
  50.     <span class="error">
  51.         <?php echo (!empty($error['err'])) ? $error['err'] : '';?>
  52.     </span>
  53. </div>
  54. <table>
  55.     <form method='POST'  action=''  id="signupForm" name='signup' >
  56.        
  57.         <tr><td><h3><u>Email:</h3></u></td>
  58.             <td><input type='text' id='email' name='email' placeholder='Enter your email'><span class="error">
  59.                 <?php echo (!empty($error['email'])) ? $error['email'] : '';?>
  60.             </span></td></tr>
  61.             <tr><td rowspan='2'><h3><u>Password:</h3></u></td>
  62.                 <td><input type='password' id='password' name='pwd' value='' placeholder='Enter Password' ><span class="error">
  63.                     <?php echo (!empty($error['pwd'])) ? $error['pwd'] : '';?>
  64.                 </span></td></tr>
  65.                
  66.     <td><input type='submit' value='Login' name='login'></td></tr>
  67. </form>
  68. </table>
Add Comment
Please, Sign In to add comment