1
|
1 |
<?php |
|
2 |
|
|
3 |
// +--------------------------------------------------------------------+ |
|
4 |
// | PowerAdmin | |
|
5 |
// +--------------------------------------------------------------------+ |
|
6 |
// | Copyright (c) 1997-2002 The PowerAdmin Team | |
|
7 |
// +--------------------------------------------------------------------+ |
|
8 |
// | This source file is subject to the license carried by the overal | |
|
9 |
// | program PowerAdmin as found on http://poweradmin.sf.net | |
|
10 |
// | The PowerAdmin program falls under the QPL License: | |
|
11 |
// | http://www.trolltech.com/developer/licensing/qpl.html | |
|
12 |
// +--------------------------------------------------------------------+ |
|
13 |
// | Authors: Roeland Nieuwenhuis <trancer <AT> trancer <DOT> nl> | |
|
14 |
// | Sjeemz <sjeemz <AT> sjeemz <DOT> nl> | |
|
15 |
// +--------------------------------------------------------------------+ |
|
16 |
|
|
17 |
// Filename: search.php |
|
18 |
// Startdate: 9-01-2003 |
|
19 |
// Searches the database for corresponding records or domains. |
|
20 |
// |
|
21 |
// The sourecode for this program was donated by DeViCeD, THANKS! |
|
22 |
// |
|
23 |
// $Id: search.php,v 1.1 2003/01/09 23:23:39 azurazu Exp $ |
|
24 |
// |
|
25 |
|
|
26 |
require_once('inc/toolkit.inc.php'); |
|
27 |
|
|
28 |
if (isset($_POST['s_submit']) || isset($_POST['q'])) |
|
29 |
{ |
|
30 |
$submitted = true; |
|
31 |
$search_result = search_record($_POST['q']); |
|
32 |
} |
|
33 |
|
|
34 |
|
|
35 |
// we will continue after the search form ... |
|
36 |
include_once('inc/header.inc.php'); |
|
37 |
?> |
|
38 |
<P><H2>Search zones or records</H2></P> |
|
39 |
<P CLASS="nav"> |
|
40 |
<A HREF="index.php">DNS Admin</A> |
|
41 |
<? |
|
42 |
if (level(10)) |
|
43 |
{ |
|
44 |
?><A HREF="users.php">User Admin</A> <A HREF="seq_update.php">Synchronize Database</A><? |
|
45 |
} |
|
46 |
?> |
|
47 |
</P><BR> |
|
48 |
Type a hostname or a record in the box below and press search to see if the record exists in the system. |
|
49 |
<table border = "0" cellspacing = "4"> |
|
50 |
<form method = "post" action="<?=$_SERVER['PHP_SELF']?>"> |
|
51 |
<tr> |
|
52 |
<td class = "tdbg"><b>Enter a hostname or IP address</b></td> |
|
53 |
<td width = "510" class = "tdbg"><input type = "text" class = "input" name = "q"></td> |
|
54 |
</tr> |
|
55 |
<tr> |
|
56 |
<td class = "tdbg"> </td> |
|
57 |
<td class = "tdbg"><input type = "submit" class = "button" name = "s_submit" value = "Search"></td> |
|
58 |
</tr> |
|
59 |
</form> |
|
60 |
</table> |
|
61 |
|
|
62 |
|
|
63 |
<?php |
|
64 |
// results |
|
65 |
if ($submitted) |
|
66 |
{ |
|
67 |
echo '<br><br>'; |
|
68 |
|
|
69 |
// let's check if we found any domains ... |
|
70 |
if (count($search_result) == 2 && count($search_result['domains'])) |
|
71 |
{ |
|
72 |
?> |
|
73 |
<b>Domains found:</b> |
|
74 |
<p> |
|
75 |
<table border = "0" cellspacing = "4"> |
|
76 |
<tr style = "font-weight: Bold;"> |
|
77 |
<td class = "tdbg"> </td> |
|
78 |
<td class = "tdbg">Name</td> |
|
79 |
<td class = "tdbg">Records</td> |
|
80 |
<td class = "tdbg">Owner</td> |
|
81 |
</tr> |
|
82 |
<?php |
|
83 |
foreach($search_result['domains'] as $d) |
|
84 |
{ |
|
85 |
?> |
|
86 |
<tr> |
|
87 |
<td class = "tdbg"> |
|
88 |
<?php |
|
89 |
if (level(5)) |
|
90 |
{ |
|
91 |
echo '<a href = "delete_domain.php?id='.$d['id'].'"><img src = "images/delete.gif" alt = "[ delete zone ]" border = "0"></a>'; |
|
92 |
} |
|
93 |
else |
|
94 |
{ |
|
95 |
echo ' '; |
|
96 |
} |
|
97 |
?> |
|
98 |
</td> |
|
99 |
<td class = "tdbg"><a href = "edit.php?id=<?=$d['id']?>"><?=$d['name']?></a></td> |
|
100 |
<td class = "tdbg"><?=$d['numrec']?></td> |
|
101 |
<td class = "tdbg"><?=get_owner_from_id($d['owner'])?></td> |
|
102 |
</tr> |
|
103 |
<?php |
|
104 |
} // end foreach ... |
|
105 |
?> |
|
106 |
</table> |
|
107 |
<br><br> |
|
108 |
<?php |
|
109 |
} // end if |
|
110 |
|
|
111 |
|
|
112 |
// any records ?! |
|
113 |
if(count($search_result['records'])) |
|
114 |
{ |
|
115 |
?> |
|
116 |
<b>Records found:</b> |
|
117 |
<p> |
|
118 |
<table border = "0" cellspacing = "4"> |
|
119 |
<tr style = "font-weight: Bold;"> |
|
120 |
<td class = "tdbg"> </td> |
|
121 |
<td class = "tdbg">Name</td> |
|
122 |
<td class = "tdbg">Type</td> |
|
123 |
<td class = "tdbg">Content</td> |
|
124 |
<td class = "tdbg">Priority</td> |
|
125 |
<td class = "tdbg">TTL</td> |
|
126 |
</tr> |
|
127 |
<?php |
|
128 |
foreach($search_result['records'] as $r) |
|
129 |
{ |
|
130 |
?> |
|
131 |
<tr> |
|
132 |
<td class = "tdbg"> |
|
133 |
<?php |
|
134 |
if (($r["type"] != "SOA" && $r["type"] != "NS") || |
|
135 |
($GLOBALS["ALLOW_SOA_EDIT"] && $r["type"] == "SOA") || |
|
136 |
($GLOBALS["ALLOW_NS_EDIT"] && $r["type"] == "NS") || |
|
137 |
($r["type"] == "NS" && get_name_from_record_id($r["id"]) != get_domain_name_from_id(recid_to_domid($r["id"])) && |
|
138 |
$GLOBALS["ALLOW_NS_EDIT"] != 1)) |
|
139 |
{ |
|
140 |
?> |
|
141 |
<a href = "edit_record.php?id=<?=$r['id']?>&domain=<?=$r['domain_id']?>"><img src = "images/edit.gif" alt = "[ edit record ]" border = "0"></a> |
|
142 |
<a href = "delete_record.php?id=<?=$r['id']?>&domain=<?=$r['domain_id']?>"><img src = "images/delete.gif" alt = "[ delete record ]" border = "0"></a> |
|
143 |
<?php |
|
144 |
} // big if ;-) |
|
145 |
?> |
|
146 |
</td> |
|
147 |
<td style = "border: 1px solid #000000;"><?=$r['name']?></td> |
|
148 |
<td style = "border: 1px solid #000000;"><?=$r['type']?></td> |
|
149 |
<td style = "border: 1px solid #000000;"><?=$r['content']?></td> |
|
150 |
<?php |
|
151 |
if ($r['prio'] != 0) |
|
152 |
{ |
|
153 |
?><td style = "border: 1px solid #000000;"><?=$r['prio']?></td><?php |
|
154 |
} |
|
155 |
else |
|
156 |
{ |
|
157 |
?><td class = "tdbg"></td><?php |
|
158 |
} // else |
|
159 |
?><td style = "border: 1px solid #000000;"><?=$r['ttl']?></td> |
|
160 |
</tr> |
|
161 |
<?php |
|
162 |
} // foreach |
|
163 |
?> |
|
164 |
</table> |
|
165 |
<?php |
|
166 |
} // if |
|
167 |
if(count($search_result['domains']) == 0 && count($search_result['records']) == 0) |
|
168 |
{ |
|
169 |
?> |
|
170 |
<table border = "0" cellspacing = "4"> |
|
171 |
<tr> |
|
172 |
<td width = "510" class = "tdbg"> |
|
173 |
Nothing found for query "<?=$_POST['q']?>" |
|
174 |
</td> |
|
175 |
</tr> |
|
176 |
</table> |
|
177 |
<? |
|
178 |
} |
|
179 |
|
|
180 |
} |
|
181 |
include_once('inc/footer.inc.php'); |
|
182 |
?> |
|
183 |
|