Advertisement
Guest User

Untitled

a guest
Nov 4th, 2016
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.24 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html lang="en">
  3.  
  4. <?php
  5. if(isset($_POST['submit'])) {
  6. include 'connection.php';
  7. $username = $_POST['username'];
  8. $password = $_POST['password'];
  9. }
  10.  
  11. if($username == '' || $password == '' ){
  12. echo "Fill out the fields!";
  13. }
  14.  
  15. else {
  16.  
  17. $user = mysqli_query($conn, "SELECT is_admin from users WHERE username = '".$username."' && password = '".$password."' ");
  18. $count = mysqli_num_rows($user);
  19.  
  20.  
  21. if($count > 0) {
  22. if ($user['is_admin'] == 1) {
  23. header('Location:AdminDashboard.php');
  24. }
  25. else {
  26. header('Location:home.php');
  27. }
  28. }
  29. else {
  30. echo "Wrong User/Pass";
  31. }
  32. }
  33. ?>
  34.  
  35.  
  36. <head>
  37. <?php include('header.php'); ?>
  38. </head>
  39.  
  40. <body>
  41. <?php include('navigation.php'); ?>
  42.  
  43. <div id="loginsignup">
  44.  
  45. <!-- LOGIN PAGE -->
  46. <div class="text-center" style="padding:50px 0">
  47. <div class="logo">login</div>
  48. <!-- Main Form -->
  49. <div class="login-form-1">
  50. <form id="login-form" method="POST" class="text-left">
  51. <div class="login-form-main-message"></div>
  52. <div class="main-login-form">
  53. <div class="login-group">
  54. <div class="form-group">
  55. <label for="lg_username" class="sr-only">Username</label>
  56. <input type="text" class="form-control" id="lg_username" name="username" placeholder="username">
  57. </div>
  58. <div class="form-group">
  59. <label for="lg_password" class="sr-only">Password</label>
  60. <input type="password" class="form-control" id="lg_password" name="password" placeholder="password">
  61. </div>
  62.  
  63. </div>
  64. <input type="submit" name="submit" class="login-button"><i class="fa fa-chevron-right"></i>
  65. </div>
  66. <div class="etc-login-form">
  67. <p>Forgot your password? <a href="#">Click Here</a></p>
  68. <p>New user? <a href="#">Create new account</a></p>
  69. </div>
  70. </form>
  71. </div>
  72.  
  73. </div>
  74.  
  75.  
  76.  
  77. </div>
  78.  
  79. </body>
  80. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement