newbtophp Posted June 29, 2009 Share Posted June 29, 2009 Im getting this error when accessing index.php: Parse error: syntax error, unexpected T_STRING in /home/gamer/public_html/index.php on line 4 This is the snippet which gives the error: <?php php define('CRACK_ROOT', dirname(__FILE__ ? __FILE__: getenv('SCRIPT_FILENAME'))); //Line 4 define('LOCKED_ROOT', CRACK_ROOT . ' / www / '); define('CRACK_FILE', CRACK_ROOT . ' / crack.php'); require_once CRACK_ROOT . ' / header.php'; if($ action == 'www_php') (/* Empty the SESSION */ $ _SESSION['Key']= ''; Can anyone please help? Quote Link to comment Share on other sites More sharing options...
ShadeSlayer Posted June 29, 2009 Share Posted June 29, 2009 <?php define('CRACK_ROOT', dirname(__FILE__ ? __FILE__: getenv('SCRIPT_FILENAME'))); I don't see why you had that extra "php" there. Quote Link to comment Share on other sites More sharing options...
newbtophp Posted June 29, 2009 Author Share Posted June 29, 2009 Hmmm.. thanks for that, now i get another error: Parse error: syntax error, unexpected T_STRING, expecting T_VARIABLE or '$' in /home/gamer/public_html/index.php on line 10 if ($ action == 'www_php') //Line 10 ( / * Empty the SESSION * / $ _SESSION['Key'] = ''; $ _SESSION['Next'] = false; $ _SESSION['Zlib'] = false; $ _SESSION['Session_key'] = ''; if ($ www_php_size > = 1024 * 1024) Quote Link to comment Share on other sites More sharing options...
ShadeSlayer Posted June 29, 2009 Share Posted June 29, 2009 if ($action == 'www_php') ( / * Empty the SESSION * / $_SESSION['Key'] = ''; $_SESSION['Next'] = false; $_SESSION['Zlib'] = false; $_SESSION['Session_key'] = ''; if ($www_php_size >= 1024 * 1024) Quote Link to comment Share on other sites More sharing options...
Philip Posted June 29, 2009 Share Posted June 29, 2009 You shouldn't have spaces between $ and the variable name. Quote Link to comment Share on other sites More sharing options...
MadTechie Posted June 29, 2009 Share Posted June 29, 2009 also / * Empty the SESSION * / should be /* Empty the SESSION */ PHP does have a manual right ? Quote Link to comment Share on other sites More sharing options...
newbtophp Posted June 29, 2009 Author Share Posted June 29, 2009 Thanks again, but ooopsie another error: Parse error: syntax error, unexpected '/' in /home/gamer/public_html/index.php on line 11 if ($action == 'www_php') ( / * Empty the SESSION * / $_SESSION['Key'] = ''; //Line 11 $_SESSION['Next'] = false; $_SESSION['Zlib'] = false; $_SESSION['Session_key'] = ''; if ($www_php_size >= 1024 * 1024) Quote Link to comment Share on other sites More sharing options...
MadTechie Posted June 29, 2009 Share Posted June 29, 2009 also / * Empty the SESSION * / should be /* Empty the SESSION */ PHP does have a manual right ? Quote Link to comment Share on other sites More sharing options...
Philip Posted June 29, 2009 Share Posted June 29, 2009 Haha, look at Mad's post... I think the manual was lost in some tragic fire. Quote Link to comment Share on other sites More sharing options...
ShadeSlayer Posted June 29, 2009 Share Posted June 29, 2009 if ($action == 'www_php') { /* Empty the SESSION */ $_SESSION['Key'] = ''; //Line 11 $_SESSION['Next'] = false; $_SESSION['Zlib'] = false; $_SESSION['Session_key'] = ''; Along with the comments, you need to open statements with { instead of ( Quote Link to comment Share on other sites More sharing options...
MadTechie Posted June 29, 2009 Share Posted June 29, 2009 Those { are hard to notice from the text book Quote Link to comment Share on other sites More sharing options...
ShadeSlayer Posted June 29, 2009 Share Posted June 29, 2009 It probably says "USE CURLY BRACKETS" or something as blatantly obvious as that. Quote Link to comment Share on other sites More sharing options...
MadTechie Posted June 29, 2009 Share Posted June 29, 2009 Its only obvious once you know it but those who don't know skipped the "boring" chapters lol and jumped to the full example on chapter 13 (or whatever) Quote Link to comment Share on other sites More sharing options...
newbtophp Posted June 29, 2009 Author Share Posted June 29, 2009 Thanks alot MadTechie, ShadeSlayer, KingPhilip!!!. I've replaced apropriately, all ( with { and ) with }. Yet another error: Parse error: syntax error, unexpected ';' in /home/gamer/public_html/index.php on line 29 Heres the code: if (!file_exists($SessionKeyRoot)) { (mkdir($SessionKeyRoot, 0777); //Line 29 } Quote Link to comment Share on other sites More sharing options...
Ken2k7 Posted June 29, 2009 Share Posted June 29, 2009 Remove the ( before mkdir. Quote Link to comment Share on other sites More sharing options...
haku Posted June 29, 2009 Share Posted June 29, 2009 Lesson one for debugging code: Always count your brackets. Quote Link to comment Share on other sites More sharing options...
newbtophp Posted June 29, 2009 Author Share Posted June 29, 2009 Cheers all for the awesome help. I've got another error (i so need to learn how to debug errors). Warning: copy() [function.copy]: Filename cannot be empty in /home/gamer/public_html/run.php on line 37 File upload failed! $SessionKeyRoot=LOCKED_ROOT.$_SESSION['Session_key']; if (!file_exists($SessionKeyRoot)) mkdir($SessionKeyRoot,0777); } $www_name=strtolower($locked_file_name); $www_copy=copy($locked_file,$SessionKeyRoot.'/'.$www_name.'.dat'); //Line 37 if (!$www_copy) { echo $www_name."File upload failed!"; exit; } unlink($locked_file); $fp = fopen($SessionKeyRoot.'/'.$www_name.'.dat', "rb"); $Skip1 = fgets($fp, 10000); $Skip2 = fgets($fp, 100000); $Skip3 = fgets($fp, 100000); $www_key_data = fread($fp, 5000000); fclose($fp); Quote Link to comment Share on other sites More sharing options...
newbtophp Posted June 29, 2009 Author Share Posted June 29, 2009 Anyone please ??? Quote Link to comment Share on other sites More sharing options...
haku Posted June 30, 2009 Share Posted June 30, 2009 And line 37 is...? Quote Link to comment Share on other sites More sharing options...
newbtophp Posted June 30, 2009 Author Share Posted June 30, 2009 $www_copy=copy($locked_file,$SessionKeyRoot.'/'.$www_name.'.dat'); //Line 37 Quote Link to comment Share on other sites More sharing options...
ShadeSlayer Posted June 30, 2009 Share Posted June 30, 2009 Can you just post the file here? I'll go through it and fix all of the problems for you. Quote Link to comment Share on other sites More sharing options...
newbtophp Posted June 30, 2009 Author Share Posted June 30, 2009 Can you just post the file here? I'll go through it and fix all of the problems for you. <?php define('CRACK_ROOT',dirname(__FILE__ ? __FILE__ : getenv('SCRIPT_FILENAME'))); define('LOCKED_ROOT',CRACK_ROOT.'/www/'); define('CRACK_FILE',CRACK_ROOT.'/select.php'); require_once CRACK_ROOT.'/header.php'; /* Decryption function */ function www_dec_int($www_decint_code,$www_calc_key) { if ($www_calc_key == "") { // } else { $www_calc_key=base64_encode($www_calc_key); $www_k1=substr($www_calc_key, 0, 1); $www_k2 =substr($www_calc_key, 1, 1); $www_k3=substr($www_calc_key, 2, 1); $www_decint_code=str_replace("$", "$www_k1", $www_decint_code); $www_decint_code=str_replace("(", "$www_k2", $www_decint_code); $www_decint_code=str_replace(")", "$www_k3", $www_decint_code); } $www_decint_code=base64_decode($www_decint_code); return $www_decint_code; } if ($action=='decode') if ($locked_file_size>=1024*1024) { echo "files more than 1MB!"; exit; } else { $SessionKeyRoot=LOCKED_ROOT.$_SESSION['Session_key']; if (!file_exists($SessionKeyRoot)) mkdir($SessionKeyRoot,0777); } $www_name=strtolower($locked_file_name); $www_copy=copy($locked_file,$SessionKeyRoot.'/'.$www_name.'.dat'); if (!$www_copy) { echo $www_name."File upload failed!"; exit; } unlink($locked_file); /* Decrypt */ $fp = fopen($SessionKeyRoot.'/'.$www_name.'.dat', "rb"); $Skip1 = fgets($fp, 10000); $Skip2 = fgets($fp, 100000); $Skip3 = fgets($fp, 100000); $www_key_data = fread($fp, 5000000); fclose($fp); /* For decompression */ if ($_SESSION['zlib']) $www_key_data=gzinflate(base64_decode($www_key_data)); header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); header('Last-Modified:' . gmdate('D, d MYH: i: s') . ' GMT '); header('Cache-Control: private'); header('Pragma: no-cache'); header('Content-Encoding: none'); header('Content-Type: application/x-php'); echo www_dec_int($www_key_data,$_SESSION['key']); { exit; } if (!$_SESSION['next']) { exit('Access Denied'); } ?> <!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></title> <script language="JavaScript" type="text/javascript"> function CheckForm(form) { var locked_file=form.locked_file.value; if (locked_file=="") { alert ("Please select a file!"); return false; } } </script> </head> <body> <div> <pre> Have successfully obtain signature. </pre> </div> <form name="Decoder" method="post" enctype="multipart/form-data" action="<?=$_SERVER["PHP_SELF"]?>" onSubmit="return CheckForm(this);"> Please upload </div> <input Type="file" name="locked_file" /> <input type="hidden" name="action" value="decode" /> <br /> <input type="submit" name="Submit" value="Decode"/> </form> </body> </html> Thanks Quote Link to comment Share on other sites More sharing options...
haku Posted July 1, 2009 Share Posted July 1, 2009 $www_copy=copy($locked_file,$SessionKeyRoot.'/'.$www_name.'.dat'); It doesn't look like you are setting $locked_file anywhere. Quote Link to comment Share on other sites More sharing options...
newbtophp Posted July 1, 2009 Author Share Posted July 1, 2009 $www_copy=copy($locked_file,$SessionKeyRoot.'/'.$www_name.'.dat'); It doesn't look like you are setting $locked_file anywhere. sorry, can you give me example to solve this please?. Quote Link to comment Share on other sites More sharing options...
haku Posted July 2, 2009 Share Posted July 2, 2009 You need to set a value for $locked_file somewhere. $locked_file = "somefile.php" Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.