Advertisement
Guest User

Untitled

a guest
Jun 26th, 2019
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.48 KB | None | 0 0
  1. <form class="user" action="code.php" method="POST">
  2. <div class="form-group">
  3. <input type="email" class="form-control form-control-user" name="email" placeholder="Enter Email Address...">
  4. </div>
  5. <div class="form-group">
  6. <input type="password" class="form-control form-control-user" name="password" placeholder="Password">
  7. </div>
  8.  
  9. <button type="submit" name="login_btn" class="btn btn-primary btn-user btn-block">
  10. Login
  11. </button>
  12. <hr>
  13.  
  14. </form>
  15.  
  16. if(isset($_POST['login_btn'])) {
  17.  
  18. $password_login = $_POST['password'];
  19. $email_login = $_POST['email'];
  20. $query="select * from register where email='$email_login' and password='$password_login'";
  21.  
  22. $query_run=mysqli_query($cnx,$query);
  23. $usertypes=mysqli_fetch_array($query_run);
  24.  
  25. if( $usertypes['usertype'] == "admin")
  26. {
  27. $_SESSION['username']=$email_login;
  28.  
  29. header('Location: index.php');
  30.  
  31.  
  32. }
  33. else if($usertypes['usertype'] == "user")
  34. {
  35. $_SESSION['username']=$email_login;
  36.  
  37. header('Location: ../index.php');
  38. }
  39. else{
  40.  
  41.  
  42. $_SESSION['status']='Login or password is wrong ! Try again ';
  43. header('Location: login.php');
  44.  
  45.  
  46. }
  47.  
  48.  
  49.  
  50. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement