<?php
set_time_limit(120);
ignore_user_abort(true);
apache_setenv('no-gzip', 1);
ini_set('zlib.output_compression', 0);
ini_set('implicit_flush', 1);
$process = @$_SERVER['argv'][0];
if (empty($process))
exit();
$prc = "{$process}.prc";
file_put_contents($prc, time());
$in = "{$process}.in";
$out = "{$process}.out";
$sock = fopen("socket.txt", "w");
file_put_contents($out, "START: " . time());
flush();
flush();
flush();
for(;;) {
$msg = @file_get_contents($in);
if (!empty($msg)) {
if ($msg == "EXIT") {
fclose($sock);
file_put_contents($out, "EXIT: " . time());
@unlink($prc);
@unlink($in);
break;
} else {
fwrite($sock, $msg);
file_put_contents($out, "MSG: " . $msg);
}
@unlink($in);
}
}
?>
<pre>
<?php
if (empty($_REQUEST['process'])) {
$process = md5(time() . rand() . 'salt');
fclose(fopen("http://{$_SERVER['SERVER_NAME']}/proc.php?{$process}", "r"));
$infile = "{$process}.in";
$outfile = "{$process}.out";
$msg = @file_get_contents($outfile);
if (empty($msg)) {
echo "Could not create process!\n";
} else {
echo $msg;
?>
<form action="<?php echo $_SERVER['PHP_SELF']?>">
<input type="hidden" name="process" value="<?php echo $process ?>">
<input name="command">
<input type="submit">
</form>
<?php
}
} elseif (empty($_REQUEST['command'])) {
echo "Command is empty!\n";
?>
<form action="<?php echo $_SERVER['PHP_SELF']?>">
<input type="hidden" name="process" value="<?php echo $_REQUEST['process']?>">
<input name="command">
<input type="submit">
</form>
<?php
} else {
$process = $_REQUEST['process'];
if (!file_exists("{$process}.prc"))
die("Process not found!");
$cmd = $_REQUEST['command'];
$infile = "{$process}.in";
$outfile = "{$process}.out";
file_put_contents($infile, $cmd);
sleep(3);
$msg = @file_get_contents($outfile);
echo "Command: $cmd\nResponse: $msg\n";
if ($cmd == "EXIT")
@unlink($outfile);
?>
<form action="<?php echo $_SERVER['PHP_SELF']?>">
<input type="hidden" name="process" value="<?php echo $process ?>">
<input name="command">
<input type="submit">
</form>
<?php
}
?>
</pre>
Если Вы уже зарегистрированы на Портале - войдите в систему, если Вы еще не регистрировались - пройдите простую процедуру регистрации.