id)) { $banInfo = $pdo->prepare("SELECT * FROM user_bans WHERE uid = :id AND valid = 1"); $banInfo->bindParam(":id", $user->id, PDO::PARAM_INT); $banInfo->execute(); $banInfo = $banInfo->fetch(PDO::FETCH_OBJ); $banType = (int)$banInfo->banType; $banDate = date("m/d/Y", $banInfo->whenBanned); $banExpiration = date("m/d/Y", $banInfo->banExpiration); $banreason = cleanOutput($banInfo->banReason); if(isset($_POST['logout'])) { $user->Logout(); WebContextManager::Redirect("/"); } if(isset($_POST['agree'])) { if ($banType == 0) //warning { //user agreed to read the warning, remove the ban $unban = $pdo->prepare("UPDATE user_bans SET valid = 0 WHERE uid = :u"); $unban->bindParam(":u", $user->id, PDO::PARAM_INT); $unban->execute(); WebContextManager::Redirect("/"); } elseif ($banType == 1) //temporary { if ($banInfo->banExpiration <= time()) //ban expired, make sure the user agreeing isn't sending a post request without { //user agreed to read the warning, remove the ban $unban = $pdo->prepare("UPDATE user_bans SET valid = 0 WHERE uid = :u"); $unban->bindParam(":u", $user->id, PDO::PARAM_INT); $unban->execute(); WebContextManager::Redirect("/"); } } } $bandisplay = ""; $date = ""; $banexpirationdisplay = ""; $banagreement = ""; if ($banType == 0) { //warning stuff $bandisplay = '
Reviewed: '.$banDate.'
'; $banagreement = 'Reviewed: '.$banDate.'
'; $banexpirationdisplay = 'Expiration: '.$banExpiration.'
'; if ($banInfo->banExpiration <= time()) //ban expired { $banagreement = 'Reviewed: '.$banDate.'
'; } echo getCSS(); //print out site css echo "Reason: '.$banreason.'