Re: How to make it shorter and better?
- From: Sandman <mr@xxxxxxxxxxx>
- Date: Sat, 29 Apr 2006 12:03:19 +0200
In article <e2v6ho$ht7$2@xxxxxxxxxxxxxxx>, "AlGorr" <a@xxxxx> 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]
.
- Follow-Ups:
- Re: How to make it shorter and better?
- From: AlGorr
- Re: How to make it shorter and better?
- References:
- How to make it shorter and better?
- From: AlGorr
- How to make it shorter and better?
- Prev by Date: Re: hitting the limits
- Next by Date: My rant about unix home directories
- Previous by thread: How to make it shorter and better?
- Next by thread: Re: How to make it shorter and better?
- Index(es):
Relevant Pages
|