Posted by Sandman on 04/29/06 13:03
In article <e2v6ho$ht7$2@news.tiscali.fr>, "AlGorr" <a@a.com> wrote:
> <snip>
It's pretty tight as it is.
# Setup
$ip = $_SERVER["REMOTE_ADDR"];
$timestamp = time()-900;
# Should we die?
$c = mysqlquery("select count(id) from banIP where ip = '$ip'");
list ($count) = mysql_fetch_assoc($c);
if ($count) die;
# Remove old stuff
mysql_query("delete from caspionet where timestamp < $timestamp");
# In Caspionet?
$c = mysqlquery("select count(id) from caspionet where ip = '$ip'");
list ($count) = mysql_fetch_assoc($c);
if (!$count){
mysql_query("insert into caspionet...");
}
# Who's online?
$ips = mysql_query("select distinct ip from caspionet");
while ($r = mysql_fetch_assoc($ips)){
print "IP: $r[ip]\n";
}
--
Sandman[.net]
Navigation:
[Reply to this message]
|