Advertisement
Guest User

Untitled

a guest
Dec 13th, 2019
191
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.75 KB | None | 0 0
  1. <html>
  2. <center>
  3. <h1> <strong> Register Page </strong> </h1>
  4. <style>
  5.  
  6. body{
  7. background-color: #FF0000;
  8. }
  9. </style>
  10.  
  11. <?php
  12.  
  13. if(ISSET($_POST['login'])){
  14. header('Location:login.php');
  15.  
  16. if(ISSET($_POST['submitButton'])){
  17. $fname = $_POST['firstname'];
  18. $lname = $_POST['lastname'];
  19. $email = $_POST['email'];
  20. $username = $_POST['username'];
  21. $password = $_POST['password'];
  22. $hash = password_hash($password, PASSWORD_DEFAULT);
  23.  
  24. require('conn.php');
  25. $query = "INSERT INTO `users` (`users_id`, `fname`, `lname`, `email`, `username`, `password`) VALUES (NULL, '$fname', '$lname', '$email', '$username', '$hash');";
  26. mysqli_query($conn,$query) or DIE('Bad query');
  27. echo "GG, you registered.";
  28. ?>
  29. <form method="POST" action="<?php echo $_SERVER['PHP_SELF']; ?>">
  30. <br><br>
  31. <br><br>
  32. <input type="submit" name = "login" value = "Login">
  33. <?php
  34. if(ISSET($_POST['login'])){
  35. header('Location:login.php');
  36. }
  37. } else{
  38. ?>
  39. <body>
  40. <strong>
  41. <form method="POST" action="<?php echo $_SERVER['PHP_SELF']; ?>">
  42. first name:
  43. <input type ="text" name="firstname" value="fname">
  44. <br><br>
  45. last name:
  46. <input type ="text" name="lastname" value="lname">
  47. <br><br>
  48. email:
  49. <input type ="text" name="email" value="E-mail">
  50. <br><br>
  51. username:
  52. <input type ="text" name="username" value="Username">
  53. <br><br>
  54. password:
  55. <input type ="text" name="password" value="Password">
  56. <br><br>
  57.  
  58. <input type="submit" name = "submitButton" value = "Submit">
  59. <br><br>
  60. <?php
  61. echo "already logged in?"
  62. ?>
  63. <br><br>
  64. <input type="submit" name = "login" value = "Login">
  65. </form>
  66. <?php } ?>
  67. </body>
  68. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement