PDA

View Full Version : Php script error



telit
August 9th, 2007, 09:07 AM
http://server.novowebsoft.net:8090/sssc.php
error "No such file or directory in..."

http://server.novowebsoft.net:8090/root.zip - sources

rschoenbach
August 9th, 2007, 09:09 AM
if it says there is no such file in directory means there is no such file. check your includes and functions to see what they are actually doing and make sure all files exist.

telit
August 9th, 2007, 09:15 AM
<?PHP
function create ($h, $s, $t) {
$flag_home = "/var/mtasc/flags/";
$swf_home = "/var/mtasc/swfs/";
$src_home = "/var/mtasc/sources/";
$log_home = "/var/mtasc/logs/";
$shell_path = "/var/mtasc/compile.sh";

$header = stripslashes(urldecode($h));
$source = stripslashes(urldecode($s));

if (empty($header)) {
return("header does not exist.");
}
if (empty($source)) {
return("source does not exist.");
}
if (!ereg("[0-9:]*", $header, $arr)) {
return("header is invalid.");
} else {
if ($header != $arr[0]) {
return("header is invalid.");
}
}
if (strlen($source) < 9) {
return("source is too short.");
}





define('DEF_CNT_FILE','cnt.dat');


$uniq = (int)trim(file_get_contents(DEF_CNT_FILE));
if( empty($uniq) ){
$uniq = 0;
}
$uniq++;

$fp = fopen (DEF_CNT_FILE,'w');

flock($fp, LOCK_EX);
set_file_buffer($fp, 0);

if (!fwrite($fp, $uniq)) {
fclose($fp);
return("conflict.");
}
flock($fp, LOCK_UN);
fclose($fp);





$class_name = classname_in_source($source);
if (!$class_name) {
return("source code is invalid.");
}
if (strlen($class_name) > 128) {
return("source code is invalid.");
}

$src_dir = $src_home.$uniq;
mkdir($src_dir);
$src_name = $src_dir."/".$class_name.".as";
$fp = fopen($src_name, "wb");
fwrite($fp, $source);
fclose($fp);

$log_name = $log_home.$uniq.".txt";

$args1 = $flag_home.$uniq;
$args2 = $header;
$args3 = $swf_home.$uniq.".swf";
$args4 = $src_name;
$args5 = $log_name;
$cmd = "/bin/sh ".$shell_path." ".$args1." ".$args2." ".$args3." ".$args4." ".$args5." &";
system($cmd);
sleep(1);
while (file_exists($args1)) {
sleep(1);
}
$target = $args3;

if (file_exists($target)) {
if ($t == "SWF") {
$fp = fopen($target, "rb");
$ba = fread($fp, filesize($target));
fclose($fp);
return($ba);
} else if ($t == "ID"){
return($uniq);
} else {
return("parameter is invalid.");
}
} else {
$fp = fopen($log_name, "rb");
$ba = fread($fp, filesize($log_name));
fclose($fp);
return("compile error.\n".$ba);
}
}

function classname_in_source($source){
if (eregi ("(^[ \t]*class|[\n\r]+[ \t]*class)[ \t]+([A-Z][A-Z0-9]*)[\n\r \t]*{", $source, $regs)) {
return($regs[2]);
} else {
return(false);
}
}
?>