Advertisement
Guest User

Untitled

a guest
Sep 25th, 2017
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.49 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. echo "Thankyou for registering with Ademoimages"; //else insert new customers details into tblusers
  22. }
  23. while ($row = mysql_fetch_array($result))
  24. {
  25. $sql = "INSERT INTO users Name, Username, Password, E-mail) values(". $Username ."' '". $Password ."' '". $Name ."' '".$Email ."')'";
  26. $result = mysql_query( $sql);
  27. }
  28.  
  29. ?>
  30.  
  31.  
  32. <form action='' method='post'> <!-- post the users login details to the server database when the login button is clicked -->
  33. Name <input type='text' Name='Your Name'>
  34. Username <input type='text' name='Username'/>
  35. E-mail <input type'text' name ='E-mail'/>
  36. Password <input type='password' name='Password' />
  37. <input type='submit' value='Register'>
  38. </form>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement