PHP Zeeslag
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

index.php 1.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. <?php
  2. session_start();
  3. if (isset($_POST['register'])){
  4. $db = new SQLite3 ("db.sqlite");
  5. $username = $_POST['username'];
  6. $password = $_POST['password_1'];
  7. $sql = "INSERT INTO users (username, password) VALUES ($username, $password)";
  8. //$stmt->prepare($sql);
  9. $db->exec($sql);
  10. echo "You are registered";
  11. }
  12. ?>
  13. <!DOCTYPE html>
  14. <html lang="en">
  15. <head>
  16. <meta charset="UTF-8">
  17. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  18. <title>Document</title>
  19. </head>
  20. <body>
  21. <header>
  22. <h2>Register</h2>
  23. </header>
  24. <form method="POST" action="index.php">
  25. <div class="input-group">
  26. <label>Username</label>
  27. <input type="text" name="username">
  28. </div>
  29. <div class="input-group">
  30. <label>Email</label>
  31. <input type="text" name="email">
  32. </div>
  33. <div class="input-group">
  34. <label>Password</label>
  35. <input type="password" name="password_1">
  36. </div>
  37. <div class="input-group">
  38. <label>Confirm Password</label>
  39. <input type="password" name="password_2">
  40. </div>
  41. <div class="input-group">
  42. <button type="submit" name="register" class="btn">Register</button>
  43. </div>
  44. <p>
  45. Already signed up? <a href="login.php">Sign in</a>
  46. </p>
  47. </form>
  48. </body>
  49. </html>