Guest User

Untitled

a guest
Aug 19th, 2017
22
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.74 KB | None | 0 0
  1.  
  2.     <?php  
  3.     session_start();//session starts here  
  4.      
  5.     ?>  
  6.      
  7.      
  8.      
  9.     <html>  
  10.     <head lang="en">  
  11.         <meta charset="UTF-8">  
  12.         <link type="text/css" rel="stylesheet" href="bootstrap-3.2.0-dist\css\bootstrap.css">  
  13.         <title>Login</title>  
  14.     </head>  
  15.     <style>  
  16.         .login-panel {  
  17.             margin-top: 150px;  
  18.      
  19.     </style>  
  20.      
  21.     <body>  
  22.      
  23.      
  24.     <div class="container">  
  25.         <div class="row">  
  26.             <div class="col-md-4 col-md-offset-4">  
  27.                 <div class="login-panel panel panel-success">  
  28.                     <div class="panel-heading">  
  29.                         <h3 class="panel-title">Sign In</h3>  
  30.                     </div>  
  31.                     <div class="panel-body">  
  32.                         <form role="form" method="post" action="login.php">  
  33.                             <fieldset>  
  34.                                 <div class="form-group"  >  
  35.                                     <input class="form-control" placeholder="E-mail" name="email" type="email" autofocus>  
  36.                                 </div>  
  37.                                 <div class="form-group">  
  38.                                     <input class="form-control" placeholder="Password" name="pass" type="password" value="">  
  39.                                 </div>  
  40.      
  41.      
  42.                                     <input class="btn btn-lg btn-success btn-block" type="submit" value="login" name="login" >  
  43.      
  44.                                 <!-- Change this to a button or input when using this as a form -->  
  45.                               <!--  <a href="index.html" class="btn btn-lg btn-success btn-block">Login</a> -->  
  46.                             </fieldset>  
  47.                         </form>  
  48.                     </div>  
  49.                 </div>  
  50.             </div>  
  51.         </div>  
  52.     </div>  
  53.      
  54.      
  55.     </body>  
  56.      
  57.     </html>  
  58.      
  59.     <?php  
  60.      
  61.     include("database/db_conection.php");  
  62.      
  63.     if(isset($_POST['login']))  
  64.     {  
  65.         $user_email=$_POST['email'];  
  66.         $user_pass=$_POST['pass'];  
  67.      
  68.         $check_user="select * from users WHERE user_email='$user_email'AND user_pass='$user_pass'";  
  69.      
  70.         $run=mysqli_query($dbcon,$check_user);  
  71.      
  72.         if(mysqli_num_rows($run))  
  73.         {  
  74.             echo "<script>window.open('welcome.php','_self')</script>";  
  75.      
  76.             $_SESSION['email']=$user_email;//here session is used and value of $user_email store in $_SESSION.  
  77.      
  78.         }  
  79.         else  
  80.         {  
  81.           echo "<script>alert('Email or password is incorrect!')</script>";  
  82.         }  
  83.     }  
  84.     ?>
Add Comment
Please, Sign In to add comment