1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
|
<html>
<head>
<title>Ping Script</title>
</head>
<?php
$max_count = 10;
$unix = 1;
$windows = 0;
$register_globals = (bool) ini_get('register_gobals');
$system = ini_get('system');
$unix = (bool) $unix;
$win = (bool) $windows;
If ($register_globals)
{
$ip = getenv(REMOTE_ADDR);
$self = $PHP_SELF;
}
else
{
$submit = $_GET['submit'];
$count = $_GET['count'];
$host = $_GET['host'];
$ip = $_SERVER['REMOTE_ADDR'];
$self = $_SERVER['PHP_SELF'];
};
If ($submit == "Ping!")
{
If ($count > $max_count)
{
echo 'Maximum for count is: '.$max_count;
echo '<a href="'.$self.'">Back</a>';
}
else
{
$host= preg_replace ("/[^A-Za-z0-9.-]/","",$host);
$count= preg_replace ("/[^0-9]/","",$count);
echo '<body bgcolor="#000000" text="#FFFFFF"></body>';
echo("Ping Daten:<br>");
echo '<pre>';
if ($unix)
{
system ("ping -c$count -w$count $host");
system("killall ping");
}
else
{
system("ping -n $count $host");
}
echo '</pre>';
}
}
else
{
echo '<body bgcolor="#000000" text="#FFFFFF"></body>';
echo '<p><font size="2">Deine IP ist: '.$ip.'</font></p>';
echo '<form methode="post" action="'.$self.'">';
echo ' Bitte Host oder IP eingeben: <input type="text" name="host" value="'.$ip.'"></input><br><br>';
echo ' Wie oft möchtest du den Server Pingen? <input type="text" name="count" size="2" value="4"></input><br><br>';
echo ' <input type="submit" name="submit" value="Ping!"></input>';
echo '</form>';
echo '<br><b>'.$system.'</b>';
echo '</body></html>';
}
?> |