Advertisement
Guest User

Untitled

a guest
May 6th, 2017
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 3.54 KB | None | 0 0
  1. <?php
  2. ob_start();
  3. include("config.php");
  4. if ($_POST[register]) {
  5. $username = $_POST[username];
  6. $password = $_POST[pass];
  7. $cpassword = $_POST[cpass];
  8. $email = $_POST[emai1];
  9. $motto = $_POST[motto];
  10. $dob = $_POST[dob];
  11. $date = date("Y.m.d");
  12. //the above lines set variables with the user submitted information
  13. if($username==NULL|$password==NULL|$cpassword==NULL|$email==NULL) {
  14. //checks to make sure no fields were left blank
  15. echo "<div style=\"font-family:verdana;font-size:11px;padding:10px;width:500px;margin:10px auto 10px auto;border:1px solid #C16161;background-color:#FEDBDB;color:#C16161;\">A field was left blank.<br/><a href=\"?=back\" onClick=\"history.back()\">Back</a></div>";
  16. }else{
  17. //none were left blank!  We continue...
  18. if($password != $cpassword) {
  19. // the passwords are not the same!  
  20. echo "<div style=\"font-family:verdana;font-size:11px;padding:10px;width:500px;margin:10px auto 10px auto;border:1px solid #C16161;background-color:#FEDBDB;color:#C16161;\">Passwords do not match.<br/><a href=\"?=back\" onClick=\"history.back()\">Back</a></div>";
  21. }else{
  22. // the passwords are the same!  we continue...
  23.  
  24. // encrypts the password
  25. $checkname = mysql_query("SELECT username FROM users WHERE username='$username'");
  26. $checkname= mysql_num_rows($checkname);
  27. $checkemail = mysql_query("SELECT email FROM users WHERE email='$email'");
  28. $checkemail = mysql_num_rows($checkemail);
  29. if ($checkemail>0|$checkname>0) {
  30. // oops...someone has already registered with that username or email!
  31. echo "<div style=\"font-family:verdana;font-size:11px;padding:10px;width:500px;margin:10px auto 10px auto;border:1px solid #C16161;background-color:#FEDBDB;color:#C16161;\">The username or email is already in use.<br/><a href=\"?=back\" onClick=\"history.back()\">Back</a></div>";
  32. }else{
  33. // noone is using that email or username!  We continue...
  34. $username = htmlspecialchars($username);
  35. $password = htmlspecialchars($password);
  36. $email = htmlspecialchars($email);
  37. // the above lines make it so that there is no html in the user submitted information.
  38. //Everything seems good, lets insert.
  39. $query = mysql_query("INSERT INTO users (username, password, signedup, email, dob, motto, figure, gender, coins, films, gametickets, ssoticket)                 VALUES('$username','$password','$date','$email','$dob','$motto','hd-180-1.ch-255-64.lg-270-64.sh-300-62.hr-165-1316','M','50','50','50','DeltarLoginTicket')");
  40. // inserts the information into the database.
  41. echo ("<div style=\"font-family:verdana;font-size:11px;padding:10px;width:500px;margin:10px auto 10px auto;border:1px solid #31D525;background-color:#EEFEED;color:#31D525;\">Congratulations, you have successfully registered.</div>");
  42. echo ("<meta http-equiv=\"Refresh\" content=\"4; URL=login.php\"/>You'll be redirected to the login page in 4 or so seconds");
  43. }
  44. }
  45. }
  46. }
  47. else
  48. {
  49. // the form has not been submitted...so now we display it.
  50. echo ("
  51. <h1>Register</h1>
  52. <form method=\"POST\">
  53. Username: <input type=\"text\" size=\"15\" maxlength=\"25\" name=\"username\"><br />
  54. Password: <input type=\"password\" size=\"15\" maxlength=\"25\" name=\"pass\"><br />
  55. Confirm Password: <input type=\"password\" size=\"15\" maxlength=\"25\" name=\"cpass\"><br />
  56. Email: <input type=\"text\" size=\"15\" maxlength=\"25\" name=\"emai1\"><br />
  57. DOB: <input type=\"text\" size=\"15\" maxlength=\"25\" name=\"dob\"><br />
  58. Motto: <input type=\"text\" size=\"15\" maxlength=\"25\" name=\"motto\"><br />
  59. <input name=\"register\" type=\"submit\" value=\"Register\">
  60. </form><br />
  61. Already have a account? Login <a href=\"register.php\">here</a>.
  62. ");
  63. }
  64. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement