I am new in PHP and I am making a script. Can you help, where am I wrong? I would also like to understand it not only have the code because I am learning. It is an IP ban script (Or i want it to be :D )
<?php
mysql_connect('host', 'user', 'mypasss') or die(mysql_error()); 
mysql_select_db('databse')
$ip = (isset($_SERVER)) ? $_SERVER['REMOTE_ADDR'] : $HTTP_SERVER_VARS['REMOTE_ADDR']; 
echo "Your IP: ".$ip; 
$query = mysql_query("SELECT `ip` FROM `user` WHERE `ip` = '$ip'");
$row = mysql_fetch_array($query); 
$protocol = strpos(strtolower($_SERVER['SERVER_PROTOCOL']),'https') 
            === FALSE ? 'http' : 'https';
$host     = $_SERVER['HTTP_HOST'];
$script   = $_SERVER['SCRIPT_NAME'];
$params   = $_SERVER['QUERY_STRING'];
$currentUrl = $protocol . '://' . $host . $script . '?' . $params;
if ($row) {
   header("Location: $currentUrl/ban/ban.php"); 
   exit(); 
} else {
 $sql = mysql_query("INSERT  INTO user(ip) VALUES ('".$ip."') ");
 header("Location: $currentUrl/ban/ban.php");
}
?>
Thanks for your help :)
 
     
    