function check_ban(){
$ip=getenv('REMOTE_ADDR');
require('conf.php');
mysql_connect($dbhost, $dbuser, $dbpass);
mysql_select_db($dbname);
$sql="SELECT by_user,description FROM $banlist_t WHERE ip='$ip' LIMIT 1";
$result=mysql_query($sql);
$rows =mysql_num_rows($result);
if ($rows){list($by,$descr) = mysql_fetch_row($result);
echo ("IP adress <b>".$ip."</b> was blocked by <b>".$by."</b>.<br><br>Причина: <br><textarea name='desc'>".descr."</textarea>");
exit;}
return;
}Но мне легче. Я предпочитаю банить раз и навсегда CREATE TABLE `banlist` (
`id` mediumint(8) NOT NULL auto_increment,
`ip` varchar(15) NOT NULL default '',
`by_user` varchar(20) NOT NULL default '',
`description` text NOT NULL,
PRIMARY KEY (`id`)
) TYPE=MyISAM AUTO_INCREMENT=1;