<?
ini_set('display_errors', 1);
error_reporting(E_ALL ^ E_NOTICE);

$ping_ip_addr = $_POST['ping_ip_addr']; // input
$ping_count = $_POST['ping_count']; // select

if (get_magic_quotes_gpc())
{
$ping_ip_addr = stripslashes($ping_ip_addr);
}

$ping_count_array = array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 25);
?>
< xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Ping</title>
<meta http-equiv="Content-Type" content="text/; charset=iso-8859-9" />
<meta name="author" content="firstbase" />
<style type="text/css">
div.output {
margin:0; padding:10px; background-color:#eeeeee; border-style:solid; border-width:1px; border-color:#000000; }

body {
margin:0; padding:10px; background-color:#ffffff; }
</style>
</head>
<body>
<h1>Ping Atma</h1>
< action="<? echo $_SERVER['PHP_SELF']; ?>" method="post">
<p><label for="ping_ip_addr">IP :</label><br />
<input name="ping_ip_addr" id="ping_ip_addr" type="text" value="<? echo $_POST['submit'] == 'Ping' ? htmlentities($ping_ip_addr, ENT_QUOTES) : $_SERVER['REMOTE_ADDR'];; ?>" size="40" maxlength="15" /></p>
<p><label for="ping_count">Ping Sayısı:</label><br />
<select name="ping_count" id="ping_count">
<?
foreach ($ping_count_array as $ping_count_item)
{
echo '<option' . ($ping_count == $ping_count_item ? ' selected="selected"' : '') . '>' . $ping_count_item . '</option>' . "
";
}
?>
</select></p>
<p><input type="submit" name="submit" value="Ping At" /></p>
</>
<p>Ping atma işlemi zaman alabilir, lütfen bekleyiniz.</p>
<?

if ($_POST['submit'] == 'Ping At')
{
echo '<div class="output">' . "
";

$illegal = FALSE;

if (strlen($ping_ip_addr) > 15)
{
$illegal = TRUE;
}

if (!in_array($ping_count, $ping_count_array))
{
$illegal = TRUE;
}

if (!$illegal) // submission was not spoofed.
{
if (ereg('^[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}$', $ping_ip_addr)) // Acquired data contains no problems.
{
// Display result.

echo '<pre>' . "
" .
'ping -c ' . $ping_count . ' ' . $ping_ip_addr . "

";

system('ping -c ' . $ping_count . ' ' . $ping_ip_addr);

echo '</pre>' . "
" .
'<p>Ping tamamlandı.</p>' . "
";
}
else
{
echo '<p>Lütfen geçerli bir IP giriniz.</p>' . "
";
}
}
else
{
echo '<p>Bir oluştu.</p>' . "
";
}

echo '</div>' . "
";
}
?>
</body>
</>

kaynak: ordan burdan

Tags: , , , , , , , , , , ,
Php - Ping Atmak (scripti, nasıl, nedir?) konusu
Benzer yazılar:
    Benzer yazı yok