Guest User

Untitled

a guest
Oct 23rd, 2017
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.86 KB | None | 0 0
  1. <?php
  2. //connect to database
  3. $db = mysqli_connect('localhost', 'root', '', 'ticketing');
  4.  
  5. if (isset($_POST['submit']))
  6. {
  7. session_start();
  8. $username = ($_POST['username']);
  9. $email = ($_POST['email']);
  10. $password =($_POST['password']);
  11. $re_type = ($_POST['re_type']);
  12.  
  13. if ($password == $re_type)
  14. {
  15. //create user
  16. $sql = "INSERT INTO registration VALUES ('$_POST[username]','$_POST[email]','$_POST[password]','$_POST[re_type]')";
  17. mysqli_query($db, $sql);
  18. $_SESSION['message'] = "You are now logged in";
  19. $_SESSION['username'] = $username;
  20. $_SESSION['email'] = $email;
  21. $_SESSION['password'] = $password;
  22. $_SESSION['re_type'] = $re_type;
  23. header("location:waley.php"); //redirect to homepage
  24. }
  25.  
  26. else
  27. {
  28. $_SESSION['message'] = "The two passwords do not match";
  29. }
  30. }
  31. ?>
Add Comment
Please, Sign In to add comment