Advertisement
Guest User

Untitled

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