Advertisement
Guest User

Untitled

a guest
Jun 27th, 2018
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.48 KB | None | 0 0
  1. <?php
  2.  
  3. if (isset($_POST['submit'])) {
  4. $username = $_POST['spelersnaam'];
  5. $password = $_POST['password'];
  6.  
  7. $connection = mysqli_connect('localhost', 'root', '', 'loginapp');
  8. if ($connection) {
  9. echo "Het is gelukt!";
  10. } else {
  11. die("Database connectie mislukt!");
  12.  
  13. }
  14.  
  15. $query = "INSERT INTO users(username, password) ";
  16. $query .= "VALUES('$username', '$password')";
  17.  
  18. $result = mysqli_query($connection, $query);
  19.  
  20. if (!$result) {
  21. die('Query failed' . mysqli_error());
  22.  
  23.  
  24.  
  25. }
  26.  
  27.  
  28.  
  29.  
  30. }
  31.  
  32.  
  33.  
  34. ?>
  35.  
  36.  
  37. <!DOCTYPE html>
  38. <html lang="en">
  39. <head>
  40. <meta charset="UTF-8">
  41. <title>Login</title>
  42. <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css">
  43. </head>
  44. <body>
  45.  
  46.  
  47.  
  48.  
  49.  
  50.  
  51.  
  52.  
  53. <div class="container">
  54. <div class="col-xs-6">
  55. <form action="login_create.PHP" method="post">
  56. <div class="form-group">
  57. <label for="username">Gebruikersnaam</label>
  58. <input type="text" name="username" class="form-control">
  59. </div>
  60.  
  61. <div class="form-group">
  62. <label for="password">Wachtwoord</label>
  63. <input type="text" name="password" class="form-control">
  64. </div>
  65.  
  66. <input class="btn btn-primary" type="submit" name="submit" value="CREATE">
  67.  
  68.  
  69.  
  70.  
  71.  
  72.  
  73.  
  74.  
  75.  
  76. </form>
  77.  
  78. </div>
  79.  
  80.  
  81.  
  82.  
  83.  
  84. </div>
  85.  
  86.  
  87. </body>
  88. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement