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