siosin

Untitled

Mar 16th, 2020
247
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.38 KB | None | 0 0
  1. <!doctype html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <script src="js/jquery.js"></script>
  6. <script src="js/popper.js"></script>
  7. <script src="vendor/bootstrap/js/bootstrap.min.js"></script>
  8. <link rel="stylesheet" type="text/css" href="css/fa/css/fontawesome-all.min.css">
  9. <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
  10. <link rel="stylesheet" href="vendor/bootstrap/css/bootstrap.min.css">
  11. <!-- <link rel="stylesheet" type="text/css" href="css/style.css"> -->
  12. <title>MadReef</title>
  13. </head>
  14. <style>
  15. body {
  16. background-color: #282828 !important;
  17.  
  18. }
  19.  
  20. </style>
  21.  
  22. <?php
  23.  
  24.  
  25. include "connection.php";
  26. $usernamechallenge='.';
  27. $passwordchallenge='.';
  28.  
  29. session_start();
  30. $username = $password = $userError = $passError = '';
  31. if(isset($_POST['sub'])){
  32. $username = $_POST['username'];
  33. $password = $_POST['password'];
  34. if (isset($username)) {
  35. $stmtv = $db->query("SELECT * FROM users where email='$username'");
  36.  
  37. while($row = $stmtv->fetch(PDO::FETCH_ASSOC)) {
  38. global $userid;
  39. global $email;
  40. $userid=$row['id'];
  41. $email=$row['email'];
  42. $_SESSION['email']=$email;
  43. $_SESSION['userid']=$userid;
  44. $usernamechallenge = $row['email'];
  45. $passwordchallenge = $row['password'];
  46. };
  47.  
  48. };
  49.  
  50.  
  51. if (isset($username)) {
  52. if($username === $usernamechallenge && $password === $passwordchallenge){
  53. $_SESSION['login'] = true;
  54. header('LOCATION:index.php'); //go to location after successful login.
  55. die();
  56. }
  57.  
  58. if($username !== $usernamechallenge){$userError = '<strong>Invalid Username</strong>';}
  59. if($password !== $passwordchallenge){$passError = '<strong>Invalid Password</strong>';}
  60. }
  61. };
  62. ?>
  63.  
  64. <!DOCTYPE html>
  65. <!-- <html xmlns='http://www.w3.org/1999/xhtml' xml:lang='en' lang='en'> -->
  66. <head>
  67. <meta http-equiv='content-type' content='text/html;charset=utf-8' />
  68. <title>Login</title>
  69. </head>
  70.  
  71. <body>
  72.  
  73. <!-- <div class="container"> -->
  74. <div class="row">
  75. <div class="col-sm-12">
  76. <div align="center">
  77. <img src="images/madreef.png" width="300">
  78. </div>
  79. </div>
  80. </div>
  81.  
  82. <div class="row">
  83. <div class="col-sm-12">
  84. <div align="center">
  85. <div class="card" style="width: 300px;">
  86. <div class="card-header"><h5>MadReef</h5></div>
  87. <div class="card-body" align="left">
  88. <form name='login' action='' method='post'>
  89. <p>Username<br><input class="form-contol" type='text' value='' id='username' name='username' style="border-radius: 5px;border: solid 1px #cdcdcd;padding: 5px; width: 100%;"/>
  90. <div class='error'><?php echo $userError;?></div></p>
  91. <p>Password<Br><input class="form-contol" type='password' value='' id='password' name='password' style="border-radius: 5px;border: solid 1px #cdcdcd;padding: 5px; width: 100%;" />
  92. <div class='error'><?php echo $passError;?></div></p>
  93. <br>
  94. <input class="btn btn-primary" type='submit' value='Login' name='sub' / style="width: 100px;"><a href="register.php"></a>
  95. </form>
  96. </div>
  97. </div>
  98. </div>
  99. </div>
  100. </div></div></div></div></div>
  101.  
  102. <!-- </div> -->
  103. </body>
  104. </html>
Advertisement
Add Comment
Please, Sign In to add comment