Advertisement
Guest User

VerifyRegister

a guest
Mar 6th, 2018
148
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.54 KB | None | 0 0
  1. <?php
  2. require_once 'db_connect.php';
  3.  
  4. error_reporting( E_ALL );
  5. ini_set( 'display_errors', 1 );
  6.  
  7. var_dump($_POST);
  8.  
  9. if (isset($_POST['submit'])){
  10.  
  11.  
  12. if (isset($_POST['FullName']) and isset($_POST['Username']) and isset($_POST['Password']) and isset($_POST['PhoneNumber']) and isset($_POST['Email'])){
  13.  
  14. $fullname = mysqli_real_escape_string($connection, $_POST['FullName']);
  15. $username = mysqli_real_escape_string($connection, $_POST['Username']);
  16. $password = mysqli_real_escape_string($connection, $_POST['Password']);
  17. $phonenumber = mysqli_real_escape_string($connection, $_POST['PhoneNumber']);
  18. $email = mysqli_real_escape_string($connection, $_POST['Email']);
  19.  
  20. $hashpassword = password_hash($password,PASSWORD_DEFAULT);
  21.  
  22. $query = "INSERT INTO `users` (FullName,Username,Password,PhoneNumber,Email) VALUES ('$fullname','$username','$hashpassword','$phonenumber','$email')";
  23. $result = mysqli_query($connection, $query) or die(mysqli_error($connection));
  24.  
  25. $existedAcc = "SELECT * FROM `users` WHERE Email = '$email'";
  26. $resultcheck = mysqli_query($connection, $existedAcc);
  27. $count = mysqli_num_rows($resultcheck);
  28.  
  29. if($count == 1){
  30.  
  31. window.location.href='https://janmticketing.000webhostapp.com/Register/Register.php';
  32. // echo "Account is already exist! Please try a different email.";
  33. }
  34. else{
  35. if($resultcheck){
  36. window.location.href='https://janmticketing.000webhostapp.com/index.php';
  37. // echo "Successfully registered";
  38. }
  39. else{
  40. echo" error something happened";
  41. }
  42. }
  43.  
  44.  
  45. }
  46.  
  47. }
  48.  
  49. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement