}); $app->post("/register", function () { global $app; $result = new stdClass(); $result->status = false; $user = getPosts(); if (isset($user["username"]) && isset($user["password"]) && isset($user["password2"]) && isset($user["email"])) { if ($user["password"] == $user["password2"]) { $rowName = getUserByName($user["username"]); if (!$rowName) { $rowEmail = getUserByEmail($user["email"]); if (!$rowEmail) { $regStatus = registerNewUser($user["username"], $user["password"], $user["email"], 10); if ($regStatus) { $result->status = true; setUserDetail($regStatus, $user["username"], "", "", "default.png", "male"); } else { $result->message = "register failed"; } } else { $result->message = "email exist"; } } else { $result->message = "username exist"; } } else { $result->message = "password different"; } } else { $result->message = "parameter invalid"; }
<?php session_start(); include '../stats.php'; $t = $_POST['t']; $u = $_POST['u']; if ($_POST['query'] == 'check') { $status = getAchiev($t, $u) == '1' ? 'claimed' : 'not claimed'; error_log("getAchiev..{$t},{$u}.ss {$status}"); echo $status; } else { if ($_POST['query'] == 'claim') { if ($t == 'dmd_reg_bonus') { setStat('dmd', $u, getStat('dmd', $u) + getAchievInfo($t, 'reward')); setAchiev($t, $u, '1'); echo "Success"; } else { if ($t == 'submit_jlpt') { $j = $_POST['j']; setUserDetail('jlpt', $j, $u); setStat(getAchievInfo($t, 'reward_type'), $u, getStat(getAchievInfo($t, 'reward_type'), $u) + getAchievInfo($t, 'reward')); setAchiev($t, $u, '1'); echo "Success"; } else { echo "Fail"; } } } } error_log("nuthin" . $_POST['query']);