Advertisement
Guest User

Untitled

a guest
Sep 16th, 2017
138
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.47 KB | None | 0 0
  1. mysql_connect($host_db, $user_db, $password_db) or die(mysql_error());
  2. mysql_select_db($database_db) or die(mysql_error());
  3.  
  4. if ($_POST['user'] == "") {
  5. die('You must provide a username. Click<a href = "register.php"> here </a>to go back and try again.');
  6. }
  7.  
  8. if ($_POST['pass'] == "") {
  9. die('You must provide a password, <a href = "register.php"> go Back </a>.');
  10. }
  11. if ($_POST['pass'] != $_POST['passRetype']) {
  12. die('Your passwords do not match, <a href = "register.php"> go Back </a>.');
  13. }
  14. $user=$_POST["user"];
  15. $pass=$_POST["pass"];
  16. $passRetype=$_POST["passRetype"];
  17.  
  18. if ('$user' > 12) {
  19. die('Your username must be within 12 characters, <a href = "register.php"> go Back </a>.');
  20. }
  21.  
  22. $existing_account = mysql_query("SELECT * FROM characters WHERE username = '$user' LIMIT 1");
  23.  
  24. if (mysql_num_rows($existing_account) == 1) {
  25. die('This username has already been taken. Click<a href = "register.php"> here </a>to go back and try again.');
  26. }
  27.  
  28. $account_count = mysql_query("SELECT * FROM characters") or die(mysql_error());
  29.  
  30. $newID = 1;
  31.  
  32. while ($row = mysql_fetch_array($account_count)) {
  33. $newID++;
  34. }
  35.  
  36. mysql_query("INSERT INTO characters VALUES('$newID', '$user', '$pass', '3252', '3421', '0', '10', '100', '-1', '0', '0', '100', '1', '1', '0', '1', '1', '0', '127.0.0.1', '0', '0', '0', '0', '0', '0', '0', '0', '0')") or die(mysql_error());
  37.  
  38. echo ('Your account has been created. You may now login with it.');
  39.  
  40. ?>
  41.  
  42. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement