Guest User

Untitled

a guest
Jan 13th, 2018
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.71 KB | None | 0 0
  1. <?php
  2.  
  3. require_once("connect.php");
  4.  
  5. //PROCESS GET INTO STANDARD VARIABLES
  6. $newUser = $_GET["username"];
  7. $newPassword = $_GET["password"];
  8. $newEmail = $_GET["email"];
  9. if($_GET["newClass"] == "admin") {
  10. $newClass = "admin";
  11. } else if($_GET["newClass"] == "user") {
  12. $newClass = "user";
  13. }
  14.  
  15. if($_GET["subtitles"] == "on") {
  16. $newSubtitleState = 1;
  17. } else {
  18. $newSubtitleState = 0;
  19. }
  20.  
  21. //QUERY THE DATABASE FOR USERS
  22.  
  23. $userExists = mysql_numrows(mysql_query("SELECT username FROM users where username = '$newuser'"));
  24.  
  25. if ($userExists > 0) {
  26. // Username already used
  27.  
  28. echo "<?xml version='1.0' encoding='UTF-8'?>";
  29. echo "<userExists>1</userExists>";
  30. } else {
  31.  
  32. echo '<?xml version="1.0" encoding="UTF-8"?>';
  33. echo '<userExists>0</userExists>';
  34.  
  35. // Add user to users table
  36. $insertQuery = mysql_query("INSERT INTO `crazy_christmas`.`users`
  37. ( `username` ,`password` ,`email` ,`subtitleState` ,`class` )
  38. VALUES
  39. ( '$newUser' , '$newPassword', '$newEmail', '$newSubtitleState', '$newClass' )
  40. ");
  41. // Get new users UserID
  42. $newUserIDQuery = mysql_query("SELECT userID FROM `crazy_christmas`.`users` WHERE username = '$newUser' ");
  43.  
  44. while ($row = mysql_fetch_array($newUserIDQuery)) {
  45.  
  46. echo "New User's Database ID: ";
  47. $theUserID = $row2["userID"];
  48. }
  49.  
  50. //ADD USER TO GAME TRACKER WITH DB USERID
  51.  
  52. $sql = mysql_query("INSERT INTO `crazy_christmas`.`game_tracker`
  53. ( `userID` , `level_1` , `level_2` , `level_3` , `level_4` , `level_5` , `level_6` , `present_1` , `present_2` , `present_3` , `present_4` , `present_5` , `present_6` )
  54. VALUES
  55. ('$theUserID', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0')
  56. ");
  57. }
  58.  
  59.  
  60. ?>
Add Comment
Please, Sign In to add comment