I call this function on top of every page.
How would I do so it removes expired bans also? If current time()
is more than expire field.
Would really appricate help.
bans
- id
- ip
- expire
(if expire is NULL its permanent)
function
function check_bans()
{
$user_ip = $_SERVER['REMOTE_ADDR'];
// Se if users ip is banned
$query = mysql_query("SELECT ip FROM bans WHERE ip = '$user_ip'");
// If they are, kill script and show message
if (mysql_num_rows($query))
die('You have been IP banished. Expires: <b>Never</b>');
}