Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- require_once("connect.php");
- //PROCESS GET INTO STANDARD VARIABLES
- $newUser = $_GET["username"];
- $newPassword = $_GET["password"];
- $newEmail = $_GET["email"];
- if($_GET["newClass"] == "admin") {
- $newClass = "admin";
- } else if($_GET["newClass"] == "user") {
- $newClass = "user";
- }
- if($_GET["subtitles"] == "on") {
- $newSubtitleState = 1;
- } else {
- $newSubtitleState = 0;
- }
- //QUERY THE DATABASE FOR USERS
- $userExists = mysql_numrows(mysql_query("SELECT username FROM users where username = '$newuser'"));
- if ($userExists > 0) {
- // Username already used
- echo "<?xml version='1.0' encoding='UTF-8'?>";
- echo "<userExists>1</userExists>";
- } else {
- echo '<?xml version="1.0" encoding="UTF-8"?>';
- echo '<userExists>0</userExists>';
- // Add user to users table
- $insertQuery = mysql_query("INSERT INTO `crazy_christmas`.`users`
- ( `username` ,`password` ,`email` ,`subtitleState` ,`class` )
- VALUES
- ( '$newUser' , '$newPassword', '$newEmail', '$newSubtitleState', '$newClass' )
- ");
- // Get new users UserID
- $newUserIDQuery = mysql_query("SELECT userID FROM `crazy_christmas`.`users` WHERE username = '$newUser' ");
- while ($row = mysql_fetch_array($newUserIDQuery)) {
- echo "New User's Database ID: ";
- $theUserID = $row2["userID"];
- }
- //ADD USER TO GAME TRACKER WITH DB USERID
- $sql = mysql_query("INSERT INTO `crazy_christmas`.`game_tracker`
- ( `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` )
- VALUES
- ('$theUserID', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0')
- ");
- }
- ?>
Add Comment
Please, Sign In to add comment