$query = $GLOBALS["db"]->prepare("UPDATE `User_Details` SET `TimeStamp` = ? WHERE `ID` = ?"); $query->execute(array($timeStamp, $GLOBALS["ID"])); } function ifCheat($TSnew) { $query = $GLOBALS["db"]->prepare("SELECT `TimeStamp` FROM `User_Details` WHERE `ID` = ?"); $query->execute(array($GLOBALS["ID"])); $TSold = $query->fetch(PDO::FETCH_ASSOC)['TimeStamp']; if ($TSnew - $TSold < $GLOBALS['TSdiff']) { $query = $GLOBALS['db']->prepare("INSERT INTO `Cheat_Users` SET `ID` = ?,`LevelOld` = ? ,`IP` = ?, `TSnew` = ?, `TSold` = ?"); $query->execute(array($GLOBALS['ID'], $GLOBALS['Level'], $_SERVER['REMOTE_ADDR'], $TSnew, $TSold)); } } //TODO: crypt the DB also $ans = crypt($ans, $salt); if (authUser()) { $query = $db->prepare("SELECT `Level` FROM `User_Details` WHERE `ID` = ?"); $query->execute(array($ID)); $Level = $query->fetch(PDO::FETCH_ASSOC)['Level']; if (authAns()) { $timeStamp = new DateTime(); ifCheat($timeStamp->getTimeStamp()); setTimeStamp($timeStamp->getTimeStamp()); setRank($timeStamp->getTimeStamp()); echo json_encode(array("Message" => "Hooray!!", "Success" => True)); } else { echo json_encode(array("Error" => 2, "Message" => "Wrong Answer.", "Success" => False)); } } else { echo json_encode(array("Error" => 1, "Message" => "Is it really u?", "Success" => False)); }
//Session checker 3000 if (empty($_SESSION)) { header("Location: connexion.php"); } else { //Affichage "Bienvenue, pseudo" + déco $menu = true; } //Test permissions $access = RankingComment($_SESSION["pseudo"]); if ($access["miaounet_admin"] == "0") { header("Location: index.php"); } if (!empty($_POST["rank"]) and !empty($_POST["id"])) { if (isset($_POST["banchat"])) { $banchat = 1; } else { $banchat = 0; } banUserFromChat($banchat); setRank($_POST["id"], $_POST["rank"]); } if (!isset($_GET["id"])) { header("Location: index.php"); } else { $user = getUser($_GET["id"]); if (empty($user["pseudo"])) { header("Location: index.php"); } } $title = "Modification des permissions pour : " . $user["pseudo"]; include_once "vue/edit_rank.php";