Parašė BloodKiller· 2007 Rugs. 16 16:09:35
#2
Jei neklystu, tikrinti reiketu mazdaug taip ar serveris online ar offline.
Pavyzdys: http://tinklapis.com/failas.php?....8&port=80
<?php
//http://t-fusion.freehostia.com/
set_time_limit(31536000);
$timeout = 5;
if (isset($_GET['ip']) && isset($_GET['port'])) {
$ip = $_GET['ip'];
$port = abs($_GET['port']);
if (!preg_match("/^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}+$/",$ip) || !is_numeric($port)) {
echo "Blogas IP adresas arba porto numeris";
} else {
$ch = curl_init();
curl_setopt($ch,CURLOPT_URL,$ip);
curl_setopt($ch,CURLOPT_PORT,$port);
curl_setopt($ch,CURLOPT_CONNECTTIMEOUT,$timeout);
ob_start();
$ex = curl_exec($ch);
$cont = ob_get_contents();
ob_end_clean();
curl_close($ch);
ob_end_flush();
if (empty($cont)) {
echo "Offline";
} else {
echo "Online";
}
}
}
?>
Redagavo BloodKiller· 2007 Rugs. 16 16:09:50