Advertisement
Guest User

Untitled

a guest
Sep 14th, 2017
154
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.41 KB | None | 0 0
  1. <form method=post action=register.php? name=s>
  2. <table>
  3. <tr><td>Username:</td><td><input type=text name=user></td></tr>
  4. <tr><td>Password:</td><td><input type=text name=pass></td><tr>
  5. <tr><td>Confirm Pass:</td><td><input type=text name=cpass></td></tr>
  6. <tr><td>E-mail:</td><td><input type=text name=email></td><tr>
  7. <tr><td colspan=2 align=center><input type=submit value=Register></td></tr>
  8. </table>
  9. </form>
  10. <?php
  11.  
  12. //Login to your database
  13. mysql_connect("localhost", "493955_obrienray1", "pass");
  14. mysql_select_db("shadow-cms_zxq_shadow");
  15.  
  16. //Check the fields please
  17. if ($action == register) {
  18.  
  19. if (!$user || !$pass || !$email || !$cpass) {
  20. print "You must fill out all of the fields nub.";
  21.  
  22. exit;
  23.  
  24. $username = mysql_num_rows(mysql_query("SELECT * FROM users where user='$user'"));
  25.  
  26. if($username > 0) {
  27. print "Username is taken.";
  28.  
  29. $email = mysql_num_rows(mysql_query("SELECT * FROM users where user='$user'"));
  30.  
  31. if($email > 0) {
  32. print "Someone has taken that email.";
  33.  
  34. exit;
  35. }
  36.  
  37. //Check if the passwords are the same please
  38. if($pass != $cpass) {
  39. print "The passwords aren't the same nerd.";
  40.  
  41. exit;
  42. }
  43.  
  44. // Do your job by inserting the data
  45. mysql_query("INSERT into users (user, email, pass) values('$user', '$email', '$pass')");
  46. print "You have successfully register. Please wait while we work on the login.";
  47. }
  48. }
  49. }
  50. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement