Advertisement
Guest User

Untitled

a guest
Mar 9th, 2017
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.48 KB | None | 0 0
  1. <?php
  2. //is er gepost
  3. if(!empty($_POST)){
  4. //is alles ingevuld
  5. if(!empty($_POST['email']) && !empty($_POST['password'])){
  6. //email + sh1(wachtwoord + salt) gevonden wordt in database
  7. $email = $_POST['email'];
  8. $password = $_POST['password'];
  9.  
  10. $conn = new mysqli("localhost", "root", "", "phples");
  11.  
  12. $query = "SELECT * FROM users
  13. WHERE (email = '".$conn->real_escape_string($email)."');";
  14.  
  15. $result = $conn->query($query);
  16.  
  17. $user = $result->fetch_assoc();
  18.  
  19. if(password_verify($password, $user['password'])){
  20. //OK
  21. session_start();
  22. $_SESSION['user'] = $email;
  23. echo "OK, WE ZIJN BINNEN!";
  24. }else{
  25. //NIET OK
  26. echo "UGH HOUSTIN WE GOT A PROBLEM";
  27. }
  28. }
  29. }
  30.  
  31. ?><!doctype html>
  32. <html lang="en">
  33. <head>
  34. <meta charset="UTF-8">
  35. <meta name="viewport"
  36. content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
  37. <meta http-equiv="X-UA-Compatible" content="ie=edge">
  38. <title>loggedin</title>
  39.  
  40. <style>
  41. *
  42. {
  43. box-sizing: border-box;
  44. }
  45.  
  46. body
  47. {
  48. font-family: Helvetica;
  49. background-image: url('http://wallpapercave.com/wp/Wg54vSe.jpg');
  50. background-size: 120%;
  51. background-position: 0% 0%;
  52. color: #565656;
  53. }
  54.  
  55. form
  56. {
  57. position: absolute;
  58. left: 0; right: 0; top: 0; bottom: 0;
  59. margin: auto;
  60. width: 530px;
  61. height: 230px;
  62. background-color: rgba(255, 255, 255, 0.75);
  63. border-radius: 8px;
  64. border: 3px solid rgba(26, 188, 156, 0.5);
  65. box-sizing: content-box;
  66. }
  67.  
  68. fieldset
  69. {
  70. border: none;
  71. margin-top: 1em;
  72. }
  73.  
  74. legend
  75. {
  76. font-size: 1.1em;
  77. margin-bottom: 0.5em;/*
  78. color: #1abc9c;*/
  79. color: #626262;
  80. font-weight: bold;
  81. }
  82.  
  83. div
  84. {
  85. float: left;
  86. width: 50%;
  87. }
  88.  
  89. .email
  90. {
  91. width: 100%;
  92. margin-top: 1em;
  93. }
  94.  
  95. label
  96. {
  97. width: 100%;
  98. margin-top: 0.5em;
  99. padding-top: 0.5em;
  100. padding-left: 7.5%;
  101. }
  102.  
  103. .email label
  104. {
  105. padding-left: 3.75%;
  106. }
  107.  
  108. input[type=text], input[type=email], input[type=password]
  109. {
  110. width: 90%;
  111. background-color: transparent;
  112. color: #626262;
  113. padding: 0.5em 0 1em 0.5em;
  114. margin-top: 0.5em;
  115. margin-bottom: 0.25em;
  116. margin: 0.5em 5% 0.25em 5%;
  117. border: 0;
  118. border-bottom: 2px solid #626262;
  119. border-top: 2px solid #626262;
  120. font-size: 1em;
  121. padding: 0.5em;
  122. }
  123.  
  124. input[type=email]
  125. {
  126. width: 95%;
  127. margin: 0.5em 2.5% 0.25em 2.5%;
  128. }
  129.  
  130.  
  131. button
  132. {
  133. display: block;
  134. margin-left: auto;
  135. margin-right: auto;
  136. margin-top: 1em;
  137. margin-bottom: 1em;
  138. background-color: #1abc9c;
  139. color: white;
  140. padding: 0.5em 1.5em;
  141. border: 2px solid #1abc9c;
  142. font-size: 1em;
  143. width: 50%;
  144. }
  145.  
  146. button:hover
  147. {
  148. cursor: pointer;
  149. }
  150.  
  151. .feedback
  152. {
  153. width: 100%;
  154. text-align: center;
  155. color: #D6391D;
  156. font-weight: bold;
  157. }
  158. </style>
  159.  
  160. </head>
  161. <body>
  162.  
  163. <form action="" method="post">
  164.  
  165. <fieldset class="fieldset_one">
  166.  
  167. <legend>Log in</legend>
  168. <div>
  169. <label for="email">Email</label>
  170. <input type="text" name="email" id="email">
  171. </div>
  172. <div>
  173. <label for="password">Password</label>
  174. <input type="password" name="password" id="password">
  175. </div>
  176. </fieldset>
  177.  
  178. <button type="submit" >Login</button>
  179.  
  180. <div class="feedback"></div>
  181.  
  182. </form>
  183.  
  184. </body>
  185. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement