Parse error: syntax error, unexpected T_IF, expecting T_VARIABLE or '$' in /home/readingf/public_html/addefender/install.php on line 415 if ($db_checks!='no'){
I'm new to this so I don't where to close the bracket. if (file_exists($script_location.'config.php')) write_textfile_($script_location.'config.php',$cnfg); ?><p> </p><center ><h3>config.php file is saved successfully.</h3></center><? // create database scheme ($lnk = mysql_connect($readingf_adsense,$readingf_adsense,$#1shaltry#1); if ($db_checks!='no') { if ($lnk==false){ ?><br /><font color="#FF0000"><center><h3>Error: DB login is incorrect !</h3></center></font><? die; }} $lnk = mysql_select_db($db_name); if ($db_checks!='no'){ if ($lnk==false){ ?><br /><font color="#FF0000"><center><h3>Error: Can't connect to Databse !</h3></center></font><? die; }}
What program are you editing with? There's no error in what you just posted, but that file is more than 400 lines line, and it could have been anywhere above the code in the file.
<? set_time_limit(0); foreach($_REQUEST as $key => $value) { ${$key} = $value; } // end vairables ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Install</title> <style type="text/css"> <!-- body,td,th { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 10px; color: #000000; } .style1 {color: #FF0000} .style2 { font-weight: bold; font-size: 12; } #popupMask { position: absolute; z-index: 200; top: 0px; left: 0px; width: 100%; height: 100%; opacity: .4; filter: alpha(opacity=40); /* this hack is so it works in IE * I find setting the color in the css gives me more flexibility * than the PNG solution. */ background-color:transparent !important; background-color: #333333; /* this hack is for opera support * you can uncomment the background-image if you don't care about opera. * this gives you the flexibility to use any bg color that you want, instead of the png */ background-image/**/: url("images/maskBG.png") !important; // For browsers Moz, Opera, etc. background-image:none; background-repeat: repeat; } --> </style> <script language="javascript"> function mkInst(){ document.getElementById('popupMask').style.display=''; document.getElementById('inst_button').disabled=true; } function showTestConfig(){ window.open('install.php?cmd=test_config&loc='+encode64(document.getElementById('script_location').value),'','status=yes,left=10,top=10,Width=400px,Height=400px,scrollbars=no, menubar = no, location=no,toolbar = no, resizable =no'); } function showTestDB(){ window.open('install.php?cmd=db_login&db_host='+encode64(document.getElementById('db_host').value)+'&db_user='+encode64(document.getElementById('db_user').value)+'&db_pass='+encode64(document.getElementById('db_pass').value)+'&db_name='+encode64(document.getElementById('db_name').value)+'&db_prefix='+encode64(document.getElementById('db_prefix').value),'','status=yes,left=10,top=10,Width=400px,Height=400px,scrollbars=no, menubar = no, location=no,toolbar = no, resizable =no'); } var keyStr = "ABCDEFGHIJKLMNOP" + "QRSTUVWXYZabcdef" + "ghijklmnopqrstuv" + "wxyz0123456789+/" + "="; function encode64(input) { input = escape(input); var output = ""; var chr1, chr2, chr3 = ""; var enc1, enc2, enc3, enc4 = ""; var i = 0; do { chr1 = input.charCodeAt(i++); chr2 = input.charCodeAt(i++); chr3 = input.charCodeAt(i++); enc1 = chr1 >> 2; enc2 = ((chr1 & 3) << 4) | (chr2 >> 4); enc3 = ((chr2 & 15) << 2) | (chr3 >> 6); enc4 = chr3 & 63; if (isNaN(chr2)) { enc3 = enc4 = 64; } else if (isNaN(chr3)) { enc4 = 64; } output = output + keyStr.charAt(enc1) + keyStr.charAt(enc2) + keyStr.charAt(enc3) + keyStr.charAt(enc4); chr1 = chr2 = chr3 = ""; enc1 = enc2 = enc3 = enc4 = ""; } while (i < input.length); return output; } function decode64(input) { var output = ""; var chr1, chr2, chr3 = ""; var enc1, enc2, enc3, enc4 = ""; var i = 0; // remove all characters that are not A-Z, a-z, 0-9, +, /, or = var base64test = /[^A-Za-z0-9\+\/\=]/g; if (base64test.exec(input)) { alert("There were invalid base64 characters in the input text.\n" + "Valid base64 characters are A-Z, a-z, 0-9, '+', '/',and '='\n" + "Expect errors in decoding."); } input = input.replace(/[^A-Za-z0-9\+\/\=]/g, ""); do { enc1 = keyStr.indexOf(input.charAt(i++)); enc2 = keyStr.indexOf(input.charAt(i++)); enc3 = keyStr.indexOf(input.charAt(i++)); enc4 = keyStr.indexOf(input.charAt(i++)); chr1 = (enc1 << 2) | (enc2 >> 4); chr2 = ((enc2 & 15) << 4) | (enc3 >> 2); chr3 = ((enc3 & 3) << 6) | enc4; output = output + String.fromCharCode(chr1); if (enc3 != 64) { output = output + String.fromCharCode(chr2); } if (enc4 != 64) { output = output + String.fromCharCode(chr3); } chr1 = chr2 = chr3 = ""; enc1 = enc2 = enc3 = enc4 = ""; } while (i < input.length); return unescape(output); } </script> </head> <body> <div id="popupMask" style="display:none;"><center><h3 style="background:#993333; color:#FFFFFF;"><p> </p><p> </p><p> </p>Installing, please wait...</h3></center></div> <h3>Script Installation</h3> <br /> <hr /><br /> <? switch($cmd){ default: ?> <form id="form1" name="form1" method="post" action="" onsubmit="mkInst()"> <input name="cmd" type="hidden" id="cmd" value="start_install" /> <table width="100%" cellspacing="0" cellpadding="2"> <tr> <td colspan="2"><font color="#CC0000"><strong>IMPORTANT:</strong></font> <strong>config.php </strong>file must be writable, also database user must have <strong>CREATE,DROP,SELECT,INSERT,UPDATE,DELETE</strong> privileges on database </td> </tr> <tr> <td colspan="2"> </td> </tr> <tr> <td colspan="2"><h3><font color="#CC0000"><strong>IMPORTANT:</strong></font>You must set cron job to execute cron.php once at 00:01h. (this will save mysql load if you have huge traffic)</h3></td> </tr> <tr> <td colspan="2"><strong>Example: 01 0 * * * php /Script Location/cron.php >> /dev/null </strong></td> </tr> <tr> <td> </td> <td> </td> </tr> <tr> <td colspan="2"><strong>Configuration Data <br /><hr /></strong></td> </tr> <tr> <td> </td> <td><div align="right" class="style2"><span class="style1">*</span> mandatory fields</div></td> </tr> <tr> <td> </td> <td><input type="button" name="Button" value="Test config.php" onclick="showTestConfig()" /> <input type="button" name="Button2" value="Test Database Login" onclick="showTestDB()"/></td> </tr> <tr> <td> </td> <td> </td> </tr> <tr> <td width="19%">Domain</td> <td width="81%"><input name="domain_name" type="text" value="<?=$_SERVER["HTTP_HOST"]; ?>" size="70" /> <span class="style1">*</span></td> </tr> <tr> <td>Web Domian name </td> <td><input name="wedomain_name" type="text" value="http://<?=$_SERVER["HTTP_HOST"].str_replace('install.php','',$_SERVER["SCRIPT_NAME"]);?>" size="70" /> <span class="style1">*</span></td> </tr> <tr> <td>Script Location </td> <td><input name="script_location" id="script_location" type="text" value="<?=str_replace('install.php','',$_SERVER["SCRIPT_FILENAME"]);?>" size="70" /> <span class="style1">*</span></td> </tr> <tr> <td> </td> <td> </td> </tr> <tr> <td> </td> <td><input name="db_checks" type="checkbox" id="db_checks" value="no" /> Disable Database checks (<span class="style1">not recommended</span>) </td> </tr> <tr> <td> </td> <td><input name="db_drop" type="checkbox" id="db_drop" value="no" /> Disable Drop table</td> </tr> <tr> <td>Database Host </td> <td><input type="text" name="db_host" id="db_host" value="localhost" /> <span class="style1">*</span></td> </tr> <tr> <td>Database Name </td> <td><input type="text" name="db_name" id="db_name" /> <span class="style1">*</span></td> </tr> <tr> <td>Database Username </td> <td><input type="text" name="db_user" id="db_user" /> <span class="style1">*</span></td> </tr> <tr> <td>Database Password </td> <td><input type="text" name="db_pass" id="db_pass" /> <span class="style1">*</span></td> </tr> <tr> <td>Tables prefix </td> <td><input type="text" name="db_prefix" id="db_prefix" /></td> </tr> <tr> <td> </td> <td> </td> </tr> <tr> <td colspan="2"><strong>Script Data <br /><hr /></strong></td> </tr> <tr> <td> </td> <td> </td> </tr> <tr> <td>Names</td> <td><input name="names" type="text" id="names" /> <span class="style1">*</span></td> </tr> <tr> <td>Username</td> <td><input name="user" type="text" id="user" /> <span class="style1">*</span></td> </tr> <tr> <td>Password</td> <td><input name="pass" type="text" id="pass" /> <span class="style1">*</span> (min 6 chars) </td> </tr> <tr> <td>Email</td> <td><input name="email" type="text" id="email" /> <span class="style1">* </span>(use for lost password) </td> </tr> <tr> <td> </td> <td><input type="submit" name="Submit" id="inst_button" value="Install" /></td> </tr> </table> </form> <? break; case "test_config": $clr_loc=base64_decode($loc); $chk=false; ?> <table width="80%" cellspacing="0" cellpadding="2"> <tr> <td width="37%"> </td> <td width="63%"> </td> </tr> <tr> <td>Location of config.php </td> <td><? if (@file_exists($clr_loc.'config.php')) { $chk=true; echo 'Ok'; } else echo 'Error'; ?> </td> </tr> <tr> <td>Permission of config.php </td> <td><? if ($chk){ write_textfile_($clr_loc.'config.php','test'); $flchk=read_data_from_file($clr_loc.'config.php'); if (trim($flchk)=='test'){ echo 'Ok'; write_textfile_($clr_loc.'config.php',''); } else echo 'Error'; } ?></td> </tr> <tr> <td> </td> <td><div align="right"> <input type="button" name="Submit2" value="Close" onclick="window.close()"/> </div></td> </tr> </table> <? break; case "db_login": $db_host=base64_decode($db_host);$db_user=base64_decode($db_user); $db_pass=base64_decode($db_pass);$db_name=base64_decode($db_name); $db_prefix=base64_decode($db_prefix); $chk=false; ?> <table width="80%" cellspacing="0" cellpadding="2"> <tr> <td>Database host </td> <td><? $lnk = @mysql_connect($db_host,$db_user,$db_pass); if ($lnk){ $chk=true; echo 'Ok'; } else echo 'Error'; ?></td> </tr> <tr> <td width="21%">Database login </td> <td width="79%"><? if ($chk) echo 'Ok'; else echo 'Error'; ?> </td> </tr> <tr> <td>Database name </td> <td><? if ($chk){ $lnk = @mysql_select_db($db_name); if ($lnk) echo 'Ok'; else { echo 'Error'; $chk=false; } } else echo 'Error'; ?> </td> </tr> <tr> <td>Database privileges</td> <td><? if ($chk){ $db_cc= db_check($db_host,$db_user,$db_pass,$db_name,$db_prefix); if ($db_cc==false) echo 'Error'; else echo 'Ok'; } ?></td> </tr> <tr> <td> </td> <td><div align="right"> <input type="button" name="Submit22" value="Close" onclick="window.close()"/> </div></td> </tr> </table> <? break; case "start_install": $fldom=str_replace('http:','',$wedomain_name);$fldom=str_replace('/','',$fldom); $pass=trim($pass); $err=''; if (strlen($pass)<6) $err='Error: User Password is too short !'; if (!chk_valid_email($email)) $err.='<br>Error: Please eneter valid email address !'; if (empty($domain_name) || empty($fldom) || empty($script_location) || empty($db_host) || empty($db_user) || empty($db_pass) || empty($db_name) || empty($names) || empty($user) || empty($pass) ) $err.='<br>Error: Some of mandatory fields are empty'; /// start check if no errors if (!empty($err)){ ?><p> </p><p> </p><font color="#FF0000"><center><h3><?=$err; ?></h3></center></font><p> </p><? die; } else { if(!config_php_check($script_location)){ ?><br /><font color="#FF0000"><center><h3>Error: config.php is not writable !</h3></center></font><? die; } if ($db_checks!='no'){ if (!db_check($db_host,$db_user,$db_pass,$db_name,$db_prefix)){ ?><br /><font color="#FF0000"><center><h3>Error: Wrong DB login or DB user don't have required permissions !</h3></center></font><? die; }} // if we here must start installation $cnfg='<?php /**
// create database scheme ($lnk = mysql_connect($readingf_adsense,$readingf_adsense,$#1shaltry#1); PHP: should be // create database scheme $lnk = mysql_connect($readingf_adsense,$readingf_adsense,$nr1shaltrynr1); PHP: Drop the ( at the beginning of the line. (You can call $#shaltry#1 anything you want that's legal.)