This will prevent a user to enter your site if his IP is in the list.
//Creating table
CREATE TABLE `iptable` (
`ip` VARCHAR ( 15 ) NOT NULL PRIMARY KEY ,
)
// PHP code
<?php
$host = "localhost";
$username = "";
$password = "";
$db = "";
mysql_connect("$host", "$username", "$password");
mysql_select_db($db) or die(mysql_error());
$sql = "SELECT * FROM iptable";
$result = mysql_query($sql);
$row = mysql_fetch_array($result) or die(mysql_error());
if ($_SERVER["REMOTE_ADDR"] == $row["ip"] )
{
echo "You are banned from viewing this website";
header("Location: banned.html");
}
?>