<?PHP
if(isset($_SESSION['id']) && !isset($_GET['banni']))
{
  $SelectionsBans = $bdd->prepare("SELECT * FROM bans WHERE value = ?");
  $SelectionsBans->execute(array($U['username']));
  $DetailsBans = $SelectionsBans->fetch();
  $stamp_now = time(date('H:i:s d-m-Y'));
  $stamp_expire = intval($DetailsBans['expire']);
  $expire = date('d/m/Y H:i', $DetailsBans['expire']);
  if($stamp_now < $stamp_expire)
  {
    header('Location: '.htmlspecialchars(trim($cms['lien'])).'/tribunal/'.intval($DetailsBans['id']).'');
    exit();
  } else {
  	$UPbans = $bdd->prepare('DELETE FROM bans WHERE id = ?');
  	$UPbans->execute(array($DetailsBans['id']));
  }
}

if (!isset($_GET['banni'])) {
	
  $SelectionsBans = $bdd->prepare("SELECT * FROM bans WHERE value = ?");
  $SelectionsBans->execute(array($_SERVER["REMOTE_ADDR"]));
  $DetailsBans = $SelectionsBans->fetch();
  $stamp_now = time(date('H:i:s d-m-Y'));
  $stamp_expire = intval($DetailsBans['expire']);
  $expire = date('d/m/Y H:i', $DetailsBans['expire']);
  if($stamp_now < $stamp_expire)
  {
    header('Location: '.htmlspecialchars(trim($cms['lien'])).'/tribunal/'.intval($DetailsBans['id']).'');
    exit();
  } else {
  	$UPbans = $bdd->prepare('DELETE FROM bans WHERE id = ?');
  	$UPbans->execute(array($DetailsBans['id']));
  }
}
?>