PHP Syntax Error?
<p>I have coded a nice script but i am constantly getting </p>

<pre><code>Error on line 29: Parse error, unexpected T_IF(if)
</code></pre>

<p>I have tried debugging code, wasted plenty of time. But nothing, came out.</p>

<p>Here is my code.</p>

<pre><code>&lt;?php

  include("geoip.inc");
$ip=$_SERVER['REMOTE_ADDR'];
$gi = geoip_open("GeoIP.dat",GEOIP_STANDARD);

$country_code = geoip_country_code_by_addr($gi, "$ip");
$referrer=$_SERVER['HTTP_REFERER'];
// Country name is not used so commented
// Get Country Name based on source IP
//$country = geoip_country_name_by_addr($gi, "$ip");
$real=0;
geoip_close($gi);

if(strstr(strtolower($_SERVER['HTTP_USER_AGENT']), "googlebot")) {
    $real = 1;  
}
else {
                if ($_COOKIE['iwashere'] != "yes")  {
                setcookie("iwashere", "yes", time()+315360000); 
                            if ($country_code="IN") {
                                    if(preg_match('/google/i', $referrer)) {
                                    $key = "g17x9erm28n7cgifddssfqhgorjf3e"; // Account API Key
                                    $ip = $_SERVER['REMOTE_ADDR']; // IP to Lookup

                                    $result = file_get_contents('http://www.ipqualityscore.com/api/ip_lookup.php?KEY='.$key.'&amp;IP='.$ip);
                                    $real=$result
//$result will be equal to 1 for detected proxies &amp; vpns or equal to 0 for clean IP's
                                            {if($real==0)
                                            {setcookie("testcookie", "testvalue");  
                                                        if( isset( $_COOKIE['testcookie'] ) ) {
                                                                if (isset($_POST['jstest'])) {
                                                                    $nojs = FALSE;
                                                                    } else {
  // create a hidden form and submit it with javascript
                                                                    echo '&lt;form name="jsform" id="jsform" method="post" style="display:none"&gt;';
                                                                    echo '&lt;input name="jstest" type="text" value="true" /&gt;';
                                                                    echo '&lt;script language="javascript"&gt;';
                                                                    echo 'document.jsform.submit();';
                                                                    echo '&lt;/script&gt;';
                                                                    echo '&lt;/form&gt;';
  // the variable below would be set only if the form wasn't submitted, hence JS is disabled
                                                                    $nojs = TRUE;
    }
                                                                                if ($nojs){
    $real=1;
 }


}
else    
$real=1;        
}
else
$real=1;

        } else 
            $real = 1;

    }
 else {
    $real = 1;
}
          }  }

if ($real==1) {
    include_once('Biggenius1.htm');

}

?&gt;
</code></pre>

<p>It is if inside. Please give me advice, on how can i avoid these error. And also is there any alternative to code such complex script with multiple nested if statements?</p>

<p><strong>Please post entire code:</strong></p>
