Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- error_reporting(0);
- session_start();
- // var_dump($_SESSION);
- include("include/conn.php");
- if(isset($_POST['login'])){
- $email = mysqli_real_escape_string($conn,trim($_POST['email']));
- // $pwd = md5($_POST['pwd']);
- $pwd = mysqli_real_escape_string($conn,MD5($_POST['pwd']));
- $error =array();
- if(empty($email)){
- $error['email']="Enter Your Email";
- }elseif(!filter_var($email,FILTER_VALIDATE_EMAIL)){
- $error['email']="Enter valid Email";
- }
- if(empty($pwd)){
- $error['pwd']="Enter Your Password";
- }
- // echo "<pre>";
- // var_dump($error);
- // echo "</pre>";
- $errorcount=count($error);
- if($errorcount==0){
- $login="select fnm,lnm,email,addr,age,dob from register where email='$email' and pwd='$pwd' and status='a'";
- echo $login;
- $exe=mysqli_query($conn,$login) or die(mysqli_error($conn));
- if($exe){
- $num=mysqli_num_rows($exe);
- if($num==1){
- $_SESSION['email']=$email;
- header("location:index.php");
- }else{
- $error['err']="Email Or password Incorrect";
- }
- }
- }
- }
- ?>
- <style>
- span.error{
- color:red;
- margin-left:10px;
- }
- </style>
- <div style='text-align:center;'>
- <span class="error">
- <?php echo (!empty($error['err'])) ? $error['err'] : '';?>
- </span>
- </div>
- <table>
- <form method='POST' action='' id="signupForm" name='signup' >
- <tr><td><h3><u>Email:</h3></u></td>
- <td><input type='text' id='email' name='email' placeholder='Enter your email'><span class="error">
- <?php echo (!empty($error['email'])) ? $error['email'] : '';?>
- </span></td></tr>
- <tr><td rowspan='2'><h3><u>Password:</h3></u></td>
- <td><input type='password' id='password' name='pwd' value='' placeholder='Enter Password' ><span class="error">
- <?php echo (!empty($error['pwd'])) ? $error['pwd'] : '';?>
- </span></td></tr>
- <td><input type='submit' value='Login' name='login'></td></tr>
- </form>
- </table>
Add Comment
Please, Sign In to add comment