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 = '
You\'ve received a warning
'; $date = '

Reviewed: '.$banDate.'

'; $banagreement = '

'; } elseif ($banType == 1) { //temporary ban stuff $bandisplay = '
You\'ve been temporarily banned
'; $date = '

Reviewed: '.$banDate.'

'; $banexpirationdisplay = '

Expiration: '.$banExpiration.'

'; if ($banInfo->banExpiration <= time()) //ban expired { $banagreement = '

'; } } elseif ($banType == 2) { //permanent ban stuff $bandisplay = '
You\'ve been permanently banned
'; $date = '

Reviewed: '.$banDate.'

'; } echo getCSS(); //print out site css echo "Notice"; //set page title echo '
'.$bandisplay.' '.$date.' '.$banexpirationdisplay.'

Reason: '.$banreason.'


'.$banagreement.'
'; } else { //not banned WebContextManager::Redirect("/"); }