"; $an=comm($val,80,"bat/ntp.php?op=do&date=$date&time=$time",$user,$pass,"GET"); } break; case "do": if(($date)AND($time)){ echo system("date $date"); echo system("time $time"); } break; } //---------------------------------------------------------------------------------------------------------------- function comm($ip,$port,$cgi,$user,$pass,$method) { $fp = fsockopen($ip, $port, $errno, $errstr, 1); if (!$fp) { //echo "$errstr ($errno)
\n"; $data= "lose"; }else{ $out = "$method /$cgi HTTP/1.1\r\n"; $out .= "Host: www.example.com\r\n"; $out .= "Authorization: Basic ".base64_encode("$user:$pass")."\r\n"; $out .= "Connection: Close\r\n\r\n"; // $out .= "Connection: keep-alive\r\n"; $data=''; fwrite($fp, $out); //echo stream_set_timeout($fp,1); //recieve data while (!feof($fp)) { $data.=fgets($fp, 1024); } fclose($fp); } return $data; } ?>