print "1"; } else { if ($action == "feedback") { print $data; } else { if ($action == "userexist") { print CheckUserExists($db, $_POST["username"]); } else { if ($action == "register") { print RegisterUser($db, $_POST["username"], $_POST["emailaddress"], $_POST["password"]); } else { if ($action == "activationkey") { print RemailActivationKey($db, $_POST["username"]); } else { if ($action == "activate") { print ActivateUser($db, $_POST["username"], $_POST["activationkey"]); } else { if ($action == "login") { print LogInUser($db, $_POST["username"], $_POST["password"]); } else { if ($action == "logout") { print LogOutUser($db, $_POST["username"], $_POST["datakey"]); } else { print "Error: Unknown Command"; } } } } } } }
if (count($lines) != 4) { DieError(-5); } else { //do checks $userName = $lines[0]; $passHash = $lines[1]; $user = GetUserByName($userName); if (CheckUserPassword($user, $passHash) === false) { DieError(-1); } $userId = $user['id']; $userRank = $user['status']; $userName = $user['username']; //in case casing is different if ($userRank == 0) { ActivateUser($userId); } if ($userRank == -1) { DieError(-3); } //banned //TODO: implement these things $pp = 0; //TODO: implement pp $globalRank = 0; $totalScore = GetTotalScoreFromId($user['id']); $accuracy = GetAccuracyFromId($user['id']); $playCount = GetPlaycountFromId($user['id']); //5,000 / 3 * (4n^3 - 3n^2 - n) + 1.25 * 1.8^(n - 60) $experience = 0; //$totalscore; //actually, nvm