Advertisement
Guest User

Untitled

a guest
Jun 9th, 2016
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.90 KB | None | 0 0
  1. <html>
  2. <head>
  3. <style>
  4. section.container{
  5. border: 1px solid black;
  6. padding-left: 383px;
  7. background-color: rgba(142, 51, 51, 0.32);
  8. }
  9. body {
  10. background-color: #484646;
  11. color: white;
  12.  
  13. }
  14. </style>
  15. </head>
  16. <body>
  17. <?php
  18. //checken of er op de sumbit button is geklikt
  19. if($_SERVER["REQUEST_METHOD"] == "POST"){
  20.  
  21. $login = $_POST["login"]; //
  22. $password = $_POST["password"];
  23.  
  24. $passwordHash = hash("sha256", $password);
  25.  
  26. $con = new PDO("mysql:host=localhost;dbname=bluetube;", "root", ""); // connectie met database
  27. $con->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
  28.  
  29. $statement = $con->prepare("SELECT * FROM hashing WHERE login = ? AND passwordHash = ?"); // query
  30. $statement->bindValue(1, $login); //waarde toevoegen bij ?
  31. $statement->bindValue(2, $passwordHash); // waarde toevoegen bij ?
  32.  
  33. $statement->execute(); // de query uitvoeren
  34.  
  35. $user = $statement->fetchObject(); //gooit data uit database in $user
  36. if($user === false) { // check of de gegevens van $user fout is
  37. echo "<h1>FOUT!!!</h1>";
  38. }else{
  39. Header("location: http://www.google.nl");
  40. }
  41. }
  42. ?>
  43.  
  44. <section class="container">
  45. <div class="login">
  46. <h1>Login to Web App</h1>
  47. <form method="post">
  48. <p><input type="text" name="login" value="" placeholder="Username or Email"></p>
  49. <p><input type="password" name="password" value="" placeholder="Password"></p>
  50. <p class="remember_me">
  51. <label>
  52. <input type="checkbox" name="remember_me" id="remember_me">
  53. Remember me on this computer
  54. </label>
  55. </p>
  56. <p class="submit"><input type="submit" name="commit" value="Login"></p>
  57. </form>
  58. </div>
  59. </section>
  60.  
  61. </body>
  62. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement