[PHP] Auto logout when ip-banned, what's wrong wit hthe code?

thewicard

Member
Nov 4, 2011
41
3
Hey, I try to make a code that makes people automaticly logout if ip-banned, (made for Phoenix, RevCMS) It won't work and I don't see what's wrong with it?

PHP:
<?php
$my_id = $_SESSION['user']['id'];
$is_reg_banned = mysql_query("SELECT ip_last FROM users WHERE id = '".$my_id."'") or die(mysql_error());
$is_last_banned = mysql_query("SELECT ip_reg FROM users WHERE id = '".$my_id."'") or die(mysql_error());
$if_reg_banned = mysql_query("SELECT value FROM bans WHERE value = '".$fetch_if_reg_banned."'") or die(mysql_error());
$if_last_banned = mysql_query("SELECT value FROM bans WHERE value = '".$fetch_if_last_banned."'") or die(mysql_error());
 
if($if_reg_banned == $is_reg_banned){?>
<meta http-equiv="refresh" content="0; URL=logout">
<?php
}
?><?php
if($if_last_banned == $is_last_banned){?>
<meta http-equiv="refresh" content="0; URL=logout">
<?php
}
?>
 
Jan 17, 2012
649
166
Try
PHP:
if($if_reg_banned == $is_reg_banned)
{
    $my_id = null;
    header("Location: index.php");
}
elseif($if_last_banned == $is_last_banned)
{
    $my_id = null;
    header("Location: index.php");
}
 

Users who are viewing this thread

Top