session_start() ;
include("php/connect.php") ;
$idonline = $_SESSION["user_id"] ;
if($idonline)
{
$gesperrt = "SELECT verwarnt, level FROM benutzer WHERE id = '".mysql_real_escape_string($idonline)."'" ;
$gesperrt = mysql_query($gesperrt);
while($row = mysql_fetch_object($gesperrt))
{
$verwarnt = $row->verwarnt ;
$level2 = $row->level ;
if($level2 == "1" or $level2 =="2" or $level2 == "3" or $level2 == "4")
{
echo "" ;
} else {
if($verwarnt == 3)
{
$loeschen = "DELETE FROM sessions WHERE user = '".mysql_real_escape_string($idonline)."'";
$loesch = mysql_query($loeschen) ;
session_destroy() ;
header("Location: index.php?fehler=gesperrt");
exit() ;
}}
}
}
if(!isset($_SESSION["user_id"]))
{
$cookieak = $_COOKIE["marcovolt-ch"] ;
if ($_COOKIE["marcovolt-ch"])
{
$accesssql = "SELECT * FROM sessions WHERE cookieid = '".mysql_real_escape_string($cookieak)."'" ;
$result = mysql_query ($accesssql);
if (mysql_num_rows ($result) == 1)
{
$data = mysql_fetch_array ($result);
$_SESSION["user_id"] = $data["user"] ;
$_SESSION["user_nickname"] = $data["nickname"] ;
$_SESSION["user_vorname"] = $data["vorname"] ;
$_SESSION["user_nachnamen"] = $data["nachname"] ;
$_SESSION["admin_level"] = $data["level"] ;
}
} }