A girl was pregnant, and her dad just said 8 words. A library of tool functions for the network
Last Update:2016-07-29
Source: Internet
Author: User
/*
PHP Net toolpack v0.1 08.05.2000,
by Waddler (@netlife. Fi)
Phpnettoolpack.sourceforge.net
To be distributed under GNU GPL
*/
WHOIS (hostname [, username, [port]])
Function whois ($a _server, $a _query= "", $a _port=43) {
$sock = Fsockopen ($a _server, $a _port, & $errno, & $errstr, 10);
if (! $sock)
{
echo "$errstr ($errno)
n ";
} else {
Fputs ($sock, "$a _queryrn");
while (!feof ($sock))
{
$buf = fgets ($sock, 128);
if (Ereg ("Whois Server:", $buf))
{
$a _server = Str_replace ("Whois Server:", "", $buf);
$a _server = trim ($a _server);
}
}
Fclose ($sock);
if ($a _server)
{
Print "
$a _query is registered at $a _server:
";
$sock = Fsockopen ($a _server, & $errno, & $errstr, 10);
if (! $sock)
{
echo "Could not open connection to $a _server on port $a _PORT.N";
echo "$errstr ($errno)
n ";
} else {
Fputs ($sock, "$a _queryrn");
while (!feof ($sock))
{
Echo fgets ($sock, 128);
}
Fclose ($sock);
}
} else {
echo "
$a _query is not found.
";
}
}
}
Finger (hostname [, username, [port]])
Function finger ($a _server, $a _query= "", $a _port=79) {
$sock =fsockopen ($a _server, $a _port, & $errno, & $errstr, 10);
if (! $sock)
{
$ret _str = "$errstr ($errno)
n ";
} else {
Fputs ($sock, "$a _queryn");
while (!feof ($sock)) {$ret _str. = Fgets ($sock, 128);}
Fclose ($sock);
}
echo $ret _str;
return $ret _str;
}
Traceroute (hostname)
Function traceroute ($a _query) {
EXEC ("traceroute $a _query", $ret _strs);
$str _count = count ($ret _strs);
for ($count =0; $count < $str _count; $count + +)
Print "$count/$str _count". $ret _strs[$count]. " n ";
}
// -----------------------------------------------------------
$app _name = "PHP Net toolpack";
$app _version = "0.1";
$TOOLS = Array (
"Finger" = "finger",
"Traceroute" = "traceroute",
"Whois" = "whois?"
);
When included inside On a HTML file:if ($tool = = "Listtools"){while (list ($key, $val) = each ($TOOLS)) {Print "". $val."n ";}Exit}Print appropriate HTML headerPrint "";if ($tool){Print "". $tool." for ". $query."n ";Print "N". $tool." for ". $query.".n ";} else {Print "". $app _name."n ";Print "N". $app _name."n ";}Check what tool they want-to-use and do-what-is necessarySwitch ($tool) {Case "finger":if ($query){Print "n ";Finger ($server, $query);Print "";} else {?> }BreakCase "Traceroute":if ($query){Print "n ";Traceroute ($query);Print "";} else {?> }BreakCase "Whois":if ($query){Print "n ";Whois ($server, $query);Print "";} else {?> }BreakDefaultPrint "Currently supported Tools Are:n ";while (list ($key, $val) = each ($TOOLS)) {echo "". $val."n ";}Print "n ";Break}Print "n". $app _name." V ". $app _version."n ";Print "N";?>The above describes a girl pregnant, her father only said 8 words a library of tools for the network, including a girl pregnant her father only said 8 words of the content, I hope that the PHP tutorial interested in a friend helpful.