Guest User

Untitled

a guest
Apr 17th, 2017
31
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.60 KB | None | 0 0
  1. <?php require_once'connection.php';
  2.  
  3. if (isset($_POST['submit'])) {
  4.  
  5. $sql1="SELECT * from signup";
  6. $result=mysqli_query($conn, $sql1);
  7.  
  8. while($row=mysqli_fetch_assoc($result))
  9. { if($row>0)
  10. {
  11. $table_phno=$row['phno'];
  12. $table_email=$row['email']; } # code...
  13. }
  14.  
  15. if ($result) {
  16. ;
  17. $username=$_POST['username'];
  18. $password=$_POST['password'];
  19. $email=$_POST['email'];
  20. $phno=$_POST['phno'];
  21. $ntdaddress=$_POST['ntdaddress'];
  22. $cpassword=$_POST['cpassword'];
  23. $password=$_POST['password'];
  24.  
  25. $phno=$_POST['phno'];
  26.  
  27. if ($phno==$table_phno) {
  28. echo '<script>alert("this phone number using by someone else");</script>';
  29. exit();
  30. }
  31. if($email==$table_email){
  32. echo '<script>alert("email are using by someone else");</script>';
  33. exit();
  34. }
  35. if ($cpassword !== $password) {
  36. echo '<script>alert("Password does not match!");</script>';// at this line
  37. exit();
  38. }
  39.  
  40. $sql = "INSERT INTO signup (username, email, phno, password, ntdaddress ) VALUES('$username','$email', '$phno', '$password','$ntdaddress')";
  41.  
  42.  
  43.  
  44. $result1=mysqli_query($conn, $sql);
  45. if ($result1) {
  46.  
  47. '<script>$( "#signin" ).load( "index.php" );</script>';
  48.  
  49. $sql2= "select * from signup where username='$username'";
  50. $value2=mysqli_query($conn, $sql2);
  51. while($row=mysqli_fetch_assoc($value2)){
  52. $userid=$row['userid'];
  53. echo $userid;
  54. }
  55. $sql3="INSERT into food(userid)VALUES('$userid')";
  56. $value3=mysqli_query($conn, $sql3);
  57.  
  58. $_SESSION['phno']=$_POST['phno'];
  59. $_SESSION['ntdaddress']=$_POST['ntdaddress'];
  60. $_SESSION['email']=$_POST['email'];
  61.  
  62. } else {
  63. echo "error";
  64. }
  65.  
  66. mysqli_close($conn);
  67.  
  68.  
  69. }
  70.  
  71.  
  72. }
  73. ?>
Add Comment
Please, Sign In to add comment