if ($_GET['act'] == 'answer'){
echo "
{$_GET['s']}";
exit();
}
if ($_GET['act'] == 'check'){
echo "";
//check write file
$err = false;
$fp = fopen("sys.txt", "wt");
if(!$fp) $err=true;
if(!@fwrite($fp,"123")) $err=true;
@fclose($fp);
@unlink("sys");
if($err) echo "Write file - BAD
\n";
else echo "Write file - OK
\n";
//check read page
$err = false;
$header = "GET http://mail.qip.ru/ HTTP/1.0\r\n";
$header .= "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8\r\n";
$header .= "Accept-Language: ru,en-us;q=0.7,en;q=0.3\r\n";
$header .= "User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; ru; rv:1.9.1.5) Gecko/20091102 Firefox/3.5.5\r\n";
$header .= "Host: mail.qip.ru\r\n";
$header .= "Connection: Keep-Alive\r\n\r\n";
$sckt = @fsockopen("mail.qip.ru",80);
if (!$sckt) $err=true;
else{
@fputs($sckt,$header);
while(!feof($sckt)) $serv_answer .= @fgets($sckt,2048);
@fclose($sckt);
if (!$serv_answer) $err=true;
}
if(($err) or !(preg_match('/HTTP.*200 OK/i',$serv_answer,$s))) echo "Read page - BAD
\n";
else echo "Read page - OK
\n";
echo "";
exit();
}
?>