Advertisement
Guest User

Untitled

a guest
Aug 6th, 2017
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.86 KB | None | 0 0
  1. <html>
  2. <?php
  3. if (!isset($_SESSION)) {
  4. session_start();
  5. }
  6. $database_db = "runescape";
  7. $user_db = "root";
  8. $password_db = "caution";
  9. $host_db = "localhost";
  10.  
  11.  
  12. mysql_connect($host_db, $user_db, $password_db) or die(mysql_error());
  13. mysql_select_db($database_db) or die(mysql_error());
  14.  
  15. if ($_POST['user'] == "") {
  16. die('You must provide a username. Click<a href = "register.php"> here </a>to go back and try again.');
  17. }
  18. if ($_POST['pass'] == "") {
  19. die('You must provide a password. Click<a href = "register.php"> here </a>to go back and try again.');
  20. }
  21. if ($_POST['pass'] != $_POST['passRetype']) {
  22. die('Your passwords do not match. Click<a href = "register.php"> here </a>to go back and try again.');
  23. }
  24.  
  25. $user=$_POST["user"];
  26. $pass=$_POST["pass"];
  27. $passRetype=$_POST["passRetype"];
  28.  
  29. $existing_account = mysql_query("SELECT * FROM characters WHERE username = '$user' LIMIT 1");
  30.  
  31. if (mysql_num_rows($existing_account) == 1) {
  32. die('This username has already been taken. Click<a href = "register.php"> here </a>to go back and try again.');
  33. }
  34.  
  35. $account_count = mysql_query("SELECT * FROM characters") or die(mysql_error());
  36.  
  37. $newID = 1;
  38.  
  39. while ($row = mysql_fetch_array($account_count)) {
  40. $newID++;
  41. }
  42.  
  43. mysql_query("INSERT INTO characters (ID, username, password, absX, absY, heightLevel, hitpoints, specialAmount, poisonDelay, skullTimer, pkPoints, energy, ancients, playerIsMember, dharokDamage, spellBook, appearanceSet, rights, ip, splitChat, autoRetaliate, combatmode, lastmeleemode, lastrangemode, starter, online, pet, running) VALUES('$newID', '$user', '$pass', '3090', '3490', '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());
  44.  
  45. echo 'Your account has been added to the database. You may now login.';
  46. ?>
  47.  
  48. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement