Advertisement
Guest User

Untitled

a guest
Sep 25th, 2017
428
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.46 KB | None | 0 0
  1. $Password= $_POST ['Password'];
  2. $Name= $_POST ['Name'];
  3. $Email= $_POST ['E-mail'];
  4.  
  5.  
  6.  
  7. //Database Query
  8. $sql = "SELECT Username,Password,user_id FROM users WHERE Username='".$_POST['Username']."' AND Password='".$_POST['Password']."'";
  9. // select the username and password from the database that matches the data entered in the login form found in $_post
  10. $result = @mysql_query($sql);
  11.  
  12.  
  13.  
  14. if ((mysql_num_rows($result)==1)) // if the entry matches user exists
  15. {
  16. echo "The login details entered already exist, please login as a existing customer or choose differant details";
  17. }
  18. elseif (mysql_num_rows($result)==0)
  19. {
  20. echo "Thankyou for registering with Ademoimages"; //else insert new customers details into tblusers
  21. }
  22. while ($row = mysql_fetch_array($result))
  23. {
  24. $sql = "INSERT INTO users Name, Username, Password, E-mail) values('". $Username ."','". $Password ."','". $Name ."','".$Email .")'";
  25. $result = mysql_query( $sql);
  26. }
  27.  
  28. ?>
  29.  
  30.  
  31. <form action='' method='post'> <!-- post the users login details to the server database when the login button is clicked -->
  32. Name <input type='text' Name='Your Name'>
  33. Username <input type='text' name='Username'/>
  34. E-mail <input type'text' name ='E-mail'/>
  35. Password <input type='password' name='Password' />
  36. <input type='submit' value='Register'>
  37. </form>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement