Guest User

Untitled

a guest
Oct 13th, 2018
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.38 KB | None | 0 0
  1. <?php
  2. session_start();
  3. require_once 'token.php';
  4.  
  5. $_SESSION["logeduser"] = '';
  6.  
  7.  
  8. if(isset($_POST['username']) && isset($_POST['password']))
  9.  
  10. {
  11.  
  12. if($_POST['username'] == "admin" && $_POST['password']=="password")
  13.  
  14. {
  15.  
  16. $_SESSION["logeduser"] = $_POST['username'];
  17. $token = Token::generate_token(session_id());
  18. setcookie("id", session_id());
  19. setcookie("token", $token);
  20. header('Location: control.php');
  21. header('Location: ./control.php'); //redirect to main
  22. }
  23. else
  24. {
  25. echo "<script>alert('Check username and password');</script>";
  26. echo "<noscript>Check username and password</noscript>";
  27. }
  28. }
  29.  
  30.  
  31.  
  32. ?>
  33.  
  34. <html>
  35.  
  36. <head>
  37. <meta charset="UTF-8">
  38. <title>Login Page</title>
  39. <link rel="stylesheet" href="style.css">
  40. </head>
  41.  
  42. <body>
  43. <div id="home">
  44. <center>
  45. </br><Legend><text class="textprop">Admin
  46. Login
  47. </text></legend></br>
  48. <form method ="post">
  49. <text class="textprop">Username:</text><input
  50. type="text" name="username" class="textbox"></br></br>
  51. <text class="textprop">Password:</text><input
  52. type="password" name="password" class="textbox"><br></br>
  53. <input type="submit" value="Login" /><input type="reset" value="Reset" />
  54. </form>
  55. </center>
  56. </div>
  57. </body>
  58. </html>
  59.  
  60.  
  61. <?php
  62. session_start();
  63. require_once 'token.php';
  64.  
  65. $_SESSION["logeduser"] = '';
  66.  
  67.  
  68. if(isset($_POST['username']) && isset($_POST['password']))
  69.  
  70. {
  71.  
  72. if($_POST['username'] == "admin" && $_POST['password']=="password")
  73.  
  74. {
  75.  
  76. $_SESSION["logeduser"] = $_POST['username'];
  77. $token = Token::generate_token(session_id());
  78. setcookie("id", session_id());
  79. setcookie("token", $token);
  80. header('Location: control.php');
  81. header('Location: ./control.php'); //redirect to main
  82. }
  83. else
  84. {
  85. echo "<script>alert('Check username and password');</script>";
  86. echo "<noscript>Check username and password</noscript>";
  87. }
  88. }
  89.  
  90.  
  91.  
  92. ?>
  93.  
  94. <html>
  95.  
  96. <head>
  97. <meta charset="UTF-8">
  98. <title>Login Page</title>
  99. <link rel="stylesheet" href="style.css">
  100. </head>
  101.  
  102. <body>
  103. <div id="home">
  104. <center>
  105. </br><Legend><text class="textprop">Admin
  106. Login
  107. </text></legend></br>
  108. <form method ="post">
  109. <text class="textprop">Username:</text><input
  110. type="text" name="username" class="textbox"></br></br>
  111. <text class="textprop">Password:</text><input
  112. type="password" name="password" class="textbox"><br></br>
  113. <input type="submit" value="Login" /><input type="reset" value="Reset" />
  114. </form>
  115. </center>
  116. </div>
  117. </body>
  118. </html>
Add Comment
Please, Sign In to add comment