Advertisement
Guest User

Untitled

a guest
Jun 23rd, 2018
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.76 KB | None | 0 0
  1. <?PHP
  2. ob_start();
  3. $hostname = gethostname();
  4. require_once "functions.php";
  5. $user = session_check();
  6. if (isset($user['id'])) {
  7. header("location: index.php");
  8. exit;
  9. }
  10. require_once "{$hostname}settings.php";
  11. ?>
  12.  
  13. <html>
  14.  
  15. <head>
  16.  
  17. <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/uikit/2.26.3/css/uikit.min.css" />
  18.  
  19. <script src="https://cdnjs.cloudflare.com/ajax/libs/uikit/2.26.3/js/uikit.min.js"> </script>
  20.  
  21. </head>
  22.  
  23. <body>
  24.  
  25. <?PHP
  26. if($_SERVER["REQUEST_METHOD"] == "POST"){
  27. $login = trim($_POST['username']);
  28. $pass = trim($_POST['password']);
  29.  
  30. $sql = "select * from login where login = '".$login."'";
  31. $rs = mysqli_query($dbs,$sql);
  32. $numRows = mysqli_num_rows($rs);
  33.  
  34. if($numRows == 1){
  35. $row = mysqli_fetch_assoc($rs);
  36. if(password_verify($pass,$row['password'])){
  37. echo "Password verified";
  38.  
  39. session_start();
  40. $_SESSION['username'] = $login;
  41. $_SESSION['loggedin'] = true;
  42. if ($row['role'] == 1)
  43. {
  44.  
  45.  
  46. header("refresh:2;url=queueaccept.php");
  47. }
  48. else
  49. {
  50. header("refresh:2;url=addpost.php");
  51. }
  52. }
  53. else{
  54. echo "Wrong Password";
  55. }
  56. }
  57. else{
  58. echo "No User found";
  59. }
  60. }
  61. mysqli_close($dbs);
  62. ?>
  63. <?PHP show_menu($user); ?>
  64. <form method="post" action="login.php" class="uk-form">
  65.  
  66. <fieldset data-uk-margin>
  67.  
  68. <legend>Log in</legend>
  69.  
  70. <input name="username" type="text" placeholder="username">
  71.  
  72. <input name="password" type="password" type="password" placeholder="password">
  73.  
  74. <button class="uk-button" name ="send">Go!</button>
  75.  
  76. <label><input type="checkbox">Remember me!</label>
  77.  
  78. </fieldset>
  79.  
  80. </form>
  81.  
  82.  
  83.  
  84. </body>
  85.  
  86. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement