0218fa0061c3743bba11adc2c749dfabe592ec77
[cacert-devel.git] / pages / account / 49.php
1 <? /*
2 LibreSSL - CAcert web application
3 Copyright (C) 2004-2008 CAcert Inc.
4
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; version 2 of the License.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
13
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17 */ ?>
18 <?
19 $userid=0; if(array_key_exists('userid',$_GET)) $userid=intval($_GET['userid']);
20 if($userid <= 0)
21 {
22 $domainsearch = $domain = mysql_escape_string(stripslashes($_POST['domain']));
23 if(!strstr($domain, "%"))
24 $domainsearch = "%$domain%";
25 if(preg_match("/^\d+$/",$domain))
26 $domainsearch = "";
27 $query = "select `users`.`id` as `id`, `domains`.`domain` as `domain`, `domains`.`id`as `domid` from `users`,`domains`
28 where `users`.`id`=`domains`.`memid` and
29 (`domains`.`domain` like '$domainsearch' or `domains`.`id`='$domain') and
30 `domains`.`deleted`=0 and `users`.`deleted`=0 and
31 `users`.`verified`=1
32 group by `users`.`id` limit 100";
33 $res = mysql_query($query);
34 if(mysql_num_rows($res) >= 1) { ?>
35 <table align="center" valign="middle" border="0" cellspacing="0" cellpadding="0" class="wrapper">
36 <tr>
37 <td colspan="5" class="title"><?=_("Select Specific User Account Details")?></td>
38 </tr>
39 <?
40 while($row = mysql_fetch_assoc($res))
41 { ?>
42 <tr>
43 <td class="DataTD"><?=_("Domain")?>:</td>
44 <td class="DataTD"><?=$row['domid']?></td>
45 <td class="DataTD"><a href="account.php?id=43&amp;userid=<?=$row['id']?>"><?=sanitizeHTML($row['domain'])?></a></td>
46 </tr>
47 <? } if(mysql_num_rows($res) >= 100) { ?>
48 <tr>
49 <td class="DataTD" colspan="3"><?=_("Only the first 100 rows are displayed.")?></td>
50 </tr>
51 <? } else { ?>
52 <tr>
53 <td class="DataTD" colspan="3"><? printf(_("%s rows displayed."), mysql_num_rows($res)); ?></td>
54 </tr>
55 <? } ?>
56 </table><br><br>
57 <? } elseif(mysql_num_rows($res) == 1) {
58 $row = mysql_fetch_assoc($res);
59 $_GET['userid'] = intval($row['id']);
60 } else {
61 ?><table align="center" valign="middle" border="0" cellspacing="0" cellpadding="0" class="wrapper">
62 <tr>
63 <td colspan="5" class="title"><?printf(_("No personal domains found matching %s"), sanitizeHTML($domain));?></td>
64 </tr>
65 </table><br><br><?
66 }
67
68 $query = "select `orgid`,`domain`,`id` from `orgdomains` where `domain` like '$domainsearch' or `id`='$domain' limit 100";
69 $res = mysql_query($query);
70 if(mysql_num_rows($res) >= 1) { ?>
71 <table align="center" valign="middle" border="0" cellspacing="0" cellpadding="0" class="wrapper">
72 <tr>
73 <td colspan="5" class="title"><?=_("Select Specific Organisation Account Details")?></td>
74 </tr>
75 <?
76 while($row = mysql_fetch_assoc($res))
77 { ?>
78 <tr>
79 <td class="DataTD"><?=_("Domain")?>:</td>
80 <td class="DataTD"><?=$row['id']?></td>
81 <td class="DataTD"><a href="account.php?id=26&amp;orgid=<?=intval($row['orgid'])?>"><?=sanitizeHTML($row['domain'])?></a></td>
82 </tr>
83 <? } if(mysql_num_rows($res) >= 100) { ?>
84 <tr>
85 <td class="DataTD" colspan="3"><?=_("Only the first 100 rows are displayed.")?></td>
86 </tr>
87 <? } else { ?>
88 <tr>
89 <td class="DataTD" colspan="3"><? printf(_("%s rows displayed."), mysql_num_rows($res)); ?></td>
90 </tr>
91 <? } ?>
92 </table><br><br>
93 <? } elseif(mysql_num_rows($res) == 1) {
94 $row = mysql_fetch_assoc($res);
95 $_GET['userid'] = intval($row['id']);
96 } else {
97 ?><table align="center" valign="middle" border="0" cellspacing="0" cellpadding="0" class="wrapper">
98 <tr>
99 <td colspan="5" class="title"><?printf(_("No organisational domains found matching %s"), sanitizeHTML($domain));?></td>
100 </tr>
101 </table><br><br><?
102 }
103 }
104
105 if($userid > 0)
106 {
107 header("location: account.php?id=43&userid=".intval($_GET['userid']));
108 exit;
109 }
110 ?>
111