1 |
<h1> DNS Records for MLAB </h1> |
- |
|
2 |
<pre> |
- |
|
3 |
<?php |
1 |
<?php |
4 |
// Vytáhni informace z DNS programem "host" |
- |
|
5 |
if(isset($x)) unset($x); |
- |
|
6 |
@Exec("host -a -l mlab.cz. ns.forpsi.cz",$x); |
- |
|
7 |
//echo implode("\n",$x); |
- |
|
8 |
|
2 |
|
9 |
// Ukousni začátek až po sekci odpovědi |
- |
|
10 |
reset($x); |
- |
|
11 |
while($y=each($x)) |
- |
|
12 |
{ |
- |
|
13 |
if(eregi(";; ANSWER SECTION:",$y[value])) break; |
- |
|
14 |
} |
- |
|
15 |
$x=array_slice($x,$y[key]+1); |
- |
|
16 |
|
- |
|
17 |
// Použij až po první prázdnou řádku |
- |
|
18 |
reset($x); |
- |
|
19 |
while($y=each($x)) |
- |
|
20 |
{ |
- |
|
21 |
if(eregi("^$",$y[value])) break; |
- |
|
22 |
} |
- |
|
23 |
$x=array_slice($x,0,$y[key]); |
- |
|
24 |
|
- |
|
25 |
|
- |
|
26 |
// Setřiď |
3 |
// Funkce pro třídění |
27 |
function sortf($a,$b) |
4 |
function sortf($a,$b) |
28 |
{ |
5 |
{ |
29 |
$a=preg_split("/\s+/",$a,4); |
6 |
$a=preg_split("/\s+/",$a,4); |
30 |
$b=preg_split("/\s+/",$b,4); |
7 |
$b=preg_split("/\s+/",$b,4); |
31 |
return strcmp($b[3],$a[3]); |
8 |
return strcmp($b[3],$a[3]); |
32 |
} |
9 |
} |
33 |
usort($x,"sortf"); |
- |
|
34 |
|
10 |
|
- |
|
11 |
function GetDNS($Domain) |
- |
|
12 |
{ |
- |
|
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 |
} |
- |
|
37 |
|
- |
|
38 |
// Setřiď podle abecedy |
- |
|
39 |
usort($x,"sortf"); |
- |
|
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> |