Ok, I want to basically stop all banned browsers and ips that are already in the database and just echo an error message. I also want to ban anonymous users using anonymouse.org to browse my site. My script is similar to the lavalair script, check if you see any errors in this script because it doesn't work, I can still browse my site with anonymouse.org and banned users can still enter.
The first is a function that comes in core.php that I include in register.php to prevent further registration:
<?
function error(){
$browser = mysql_query("SELECT browserm FROM prefix_table");
$ip = mysql_query("SELECT ipadd FROM prefix_table");
while($ip2 = mysql_fetch_array($ip) && $browser2 =(mysql_fetch_array($browser))){
if($REMOTE_ADDR=="$ip2" && $HTTP_USER_AGENT=="$browser2"){
return true;
}elseif($HTTP_USER_AGENT=="http://Anonymouse.org/"){
return true;
}else{
return false;
}
}
}
?>
And then I use include("core.php"); in register.php and I put the following code in register.php:
<?
if(error())
{
echo "
";
echo "Sorry, you are banned from our site.
";
echo "<a href=\"index.php\"><img src=\"images/home.gif\" alt=\"*\"/>";
echo "Home</a>";
echo "</p>";
}
?>
Please tell me if you find any errors so I can correct it cause it doesn't work.
The first is a function that comes in core.php that I include in register.php to prevent further registration:
<?
function error(){
$browser = mysql_query("SELECT browserm FROM prefix_table");
$ip = mysql_query("SELECT ipadd FROM prefix_table");
while($ip2 = mysql_fetch_array($ip) && $browser2 =(mysql_fetch_array($browser))){
if($REMOTE_ADDR=="$ip2" && $HTTP_USER_AGENT=="$browser2"){
return true;
}elseif($HTTP_USER_AGENT=="http://Anonymouse.org/"){
return true;
}else{
return false;
}
}
}
?>
And then I use include("core.php"); in register.php and I put the following code in register.php:
<?
if(error())
{
echo "
";
echo "Sorry, you are banned from our site.
";
echo "<a href=\"index.php\"><img src=\"images/home.gif\" alt=\"*\"/>";
echo "Home</a>";
echo "</p>";
}
?>
Please tell me if you find any errors so I can correct it cause it doesn't work.
Comment