title: HTTP Error 500 (Internal Server Error): An unexpected condition was encountered while the server was attempting to fulfill the request
body: <p>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 )</p>
  
  <pre><code>&lt;?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");
  }
  
  ?&gt;
  </code></pre>
  
  <p>Thanks for your help :)</p>