A girl was pregnant, and her dad just said 8 words. A library of tool functions for the network

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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.