374 |
miho |
1 |
<?php |
1027 |
miho |
2 |
|
|
|
3 |
// Funkce pro třídění |
|
|
4 |
function sortf($a,$b) |
374 |
miho |
5 |
{ |
1027 |
miho |
6 |
$a=preg_split("/\s+/",$a,4); |
|
|
7 |
$b=preg_split("/\s+/",$b,4); |
|
|
8 |
return strcmp($b[3],$a[3]); |
374 |
miho |
9 |
} |
|
|
10 |
|
1027 |
miho |
11 |
function GetDNS($Domain) |
374 |
miho |
12 |
{ |
1027 |
miho |
13 |
// Vytáhni informace z DNS programem "host" |
|
|
14 |
if(isset($x)) unset($x); |
|
|
15 |
@Exec("host -a -l $Domain ns.forpsi.cz",$x); |
|
|
16 |
//echo implode("\n",$x); |
|
|
17 |
|
|
|
18 |
// Ukousni začátek až po sekci odpovědi |
|
|
19 |
reset($x); |
|
|
20 |
while($y=each($x)) |
|
|
21 |
{ |
|
|
22 |
if(eregi(";; ANSWER SECTION:",$y[value])) break; |
|
|
23 |
} |
|
|
24 |
$x=array_slice($x,$y[key]+1); |
|
|
25 |
|
|
|
26 |
// Vyhoď prázdné řádky a komentáře |
|
|
27 |
reset($x); |
|
|
28 |
while($y=each($x)) |
|
|
29 |
{ |
|
|
30 |
if(eregi("^$",$y[value])) |
|
|
31 |
unset($x[$y[key]]); |
|
|
32 |
if(eregi("^;.*$",$y[value])) |
|
|
33 |
unset($x[$y[key]]); |
|
|
34 |
if(eregi("^Received .*$",$y[value])) |
|
|
35 |
unset($x[$y[key]]); |
|
|
36 |
} |
374 |
miho |
37 |
|
1027 |
miho |
38 |
// Setřiď podle abecedy |
|
|
39 |
usort($x,"sortf"); |
374 |
miho |
40 |
|
1027 |
miho |
41 |
// Výsledek |
|
|
42 |
$x=implode("\n",$x); |
|
|
43 |
if ($x=="") $x="No Data\n"; |
|
|
44 |
|
|
|
45 |
return $x; |
374 |
miho |
46 |
} |
|
|
47 |
?> |
1027 |
miho |
48 |
|
|
|
49 |
<h1> DNS Records for MLAB </h1> |
|
|
50 |
<pre> |
|
|
51 |
<?php |
|
|
52 |
echo GetDNS('mlab.cz.'); |
|
|
53 |
?> |
374 |
miho |
54 |
</pre> |
1027 |
miho |
55 |
|
|
|
56 |
<h1> DNS Records for USR </h1> |
|
|
57 |
<pre> |
|
|
58 |
<?php |
|
|
59 |
echo GetDNS('ust.cz.'); |
|
|
60 |
?> |
|
|
61 |
</pre> |