remove cacert/ prefix
[cacert.git] / pages / account / 43.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 if(array_key_exists('assurance',$_REQUEST) && $_REQUEST['assurance'] > 0)
20 {
21 $assurance = mysql_escape_string(intval($_REQUEST['assurance']));
22 $row = 0;
23 $res = mysql_query("select `to` from `notary` where `id`='$assurance'");
24 if ($res) {
25 $row = mysql_fetch_assoc($res);
26 }
27 mysql_query("delete from `notary` where `id`='$assurance'");
28 if ($row) {
29 fix_assurer_flag($row['to']);
30 }
31 }
32
33 if(intval(array_key_exists('userid',$_REQUEST)?$_REQUEST['userid']:0) <= 0)
34 {
35 $emailsearch = $email = mysql_escape_string(stripslashes($_REQUEST['email']));
36
37 //Disabled to speed up the queries
38 //if(!strstr($email, "%"))
39 // $emailsearch = "%$email%";
40
41 if(intval($email) > 0)
42 $emailsearch = "";
43
44 $query = "select `users`.`id` as `id`, `email`.`email` as `email` from `users`,`email`
45 where `users`.`id`=`email`.`memid` and
46 (`email`.`email` like '$emailsearch' or `email`.`id`='$email' or `users`.`id`='$email') and
47 `email`.`hash`='' and `email`.`deleted`=0 and `users`.`deleted`=0
48 group by `users`.`id` limit 100";
49 $res = mysql_query($query);
50 if(mysql_num_rows($res) > 1) { ?>
51 <table align="center" valign="middle" border="0" cellspacing="0" cellpadding="0" class="wrapper">
52 <tr>
53 <td colspan="5" class="title"><?=_("Select Specific Account Details")?></td>
54 </tr>
55 <tr>
56 <td class="DataTD"><?=_("User ID")?></td>
57 <td class="DataTD"><?=_("Email")?></td>
58 </tr>
59 <?
60 while($row = mysql_fetch_assoc($res))
61 { ?>
62 <tr>
63 <td class="DataTD"><a href="account.php?id=43&amp;userid=<?=intval($row['id'])?>"><?=intval($row['id'])?></a></td>
64 <td class="DataTD"><a href="account.php?id=43&amp;userid=<?=intval($row['id'])?>"><?=sanitizeHTML($row['email'])?></a></td>
65 </tr>
66 <? } if(mysql_num_rows($res) >= 100) { ?>
67 <tr>
68 <td class="DataTD" colspan="2"><?=_("Only the first 100 rows are displayed.")?></td>
69 </tr>
70 <? } else { ?>
71 <tr>
72 <td class="DataTD" colspan="2"><? printf(_("%s rows displayed."), mysql_num_rows($res)); ?></td>
73 </tr>
74 <? } ?>
75 </table><br><br>
76 <? } elseif(mysql_num_rows($res) == 1) {
77 $row = mysql_fetch_assoc($res);
78 $_REQUEST['userid'] = $row['id'];
79 } else {
80 printf(_("No users found matching %s"), sanitizeHTML($email));
81 }
82 }
83
84 if(intval($_REQUEST['userid']) > 0)
85 {
86 $id = intval($_REQUEST['userid']);
87 $query = "select * from `users` where `id`='$id' and `users`.`deleted`=0";
88 $res = mysql_query($query);
89 if(mysql_num_rows($res) <= 0)
90 {
91 echo _("I'm sorry, the user you were looking for seems to have disappeared! Bad things are a foot!");
92 } else {
93 $row = mysql_fetch_assoc($res);
94 $query = "select sum(`points`) as `points` from `notary` where `to`='".intval($row['id'])."'";
95 $dres = mysql_query($query);
96 $drow = mysql_fetch_assoc($dres);
97 $alerts = mysql_fetch_assoc(mysql_query("select * from `alerts` where `memid`='".intval($row['id'])."'"));
98 ?>
99 <table align="center" valign="middle" border="0" cellspacing="0" cellpadding="0" class="wrapper">
100 <tr>
101 <td colspan="5" class="title"><? printf(_("%s's Account Details"), sanitizeHTML($row['email'])); ?></td>
102 </tr>
103 <tr>
104 <td class="DataTD"><?=_("Email")?>:</td>
105 <td class="DataTD"><?=sanitizeHTML($row['email'])?></td>
106 </tr>
107 <tr>
108 <td class="DataTD"><?=_("First Name")?>:</td>
109 <td class="DataTD"><form method="post" action="account.php" onSubmit="if(!confirm('<?=_("Are you sure you want to modify this DOB and/or last name?")?>')) return false;">
110 <input type="hidden" name="csrf" value="<?=make_csrf('admchangepers')?>" />
111 <input type="text" name="fname" value="<?=sanitizeHTML($row['fname'])?>"></td>
112 </tr>
113 <tr>
114 <td class="DataTD"><?=_("Middle Name")?>:</td>
115 <td class="DataTD"><input type="text" name="mname" value="<?=sanitizeHTML($row['mname'])?>"></td>
116 </tr>
117 <tr>
118 <td class="DataTD"><?=_("Last Name")?>:</td>
119 <td class="DataTD"> <input type="hidden" name="oldid" value="43">
120 <input type="hidden" name="action" value="updatedob">
121 <input type="hidden" name="userid" value="<?=intval($id)?>">
122 <input type="text" name="lname" value="<?=sanitizeHTML($row['lname'])?>"></td>
123 </tr>
124 <tr>
125 <td class="DataTD"><?=_("Suffix")?>:</td>
126 <td class="DataTD"><input type="text" name="suffix" value="<?=sanitizeHTML($row['suffix'])?>"></td>
127 </tr>
128 <tr>
129 <td class="DataTD"><?=_("Date of Birth")?>:</td>
130 <td class="DataTD">
131 <?
132 $year = intval(substr($row['dob'], 0, 4));
133 $month = intval(substr($row['dob'], 5, 2));
134 $day = intval(substr($row['dob'], 8, 2));
135 ?><nobr><select name="day">
136 <?
137 for($i = 1; $i <= 31; $i++)
138 {
139 echo "<option";
140 if($day == $i)
141 echo " selected='selected'";
142 echo ">$i</option>";
143 }
144 ?>
145 </select>
146 <select name="month">
147 <?
148 for($i = 1; $i <= 12; $i++)
149 {
150 echo "<option value='$i'";
151 if($month == $i)
152 echo " selected='selected'";
153 echo ">".ucwords(strftime("%B", mktime(0,0,0,$i,1,date("Y"))))."</option>";
154 }
155 ?>
156 </select>
157 <input type="text" name="year" value="<?=$year?>" size="4">
158 <input type="submit" value="Go"></form></nobr></td>
159 </tr>
160 <tr>
161 <td class="DataTD"><?=_("Trainings")?>:</td>
162 <td class="DataTD"><a href="account.php?id=55&amp;userid=<?=intval($row['id'])?>">show</a></td>
163 </tr>
164 <tr>
165 <td class="DataTD"><?=_("Is Assurer")?>:</td>
166 <td class="DataTD"><a href="account.php?id=43&amp;assurer=<?=intval($row['id'])?>&amp;csrf=<?=make_csrf('admsetassuret')?>"><?=$row['assurer']?></a></td>
167 </tr>
168 <tr>
169 <td class="DataTD"><?=_("Blocked Assurer")?>:</td>
170 <td class="DataTD"><a href="account.php?id=43&amp;assurer_blocked=<?=intval($row['id'])?>"><?=$row['assurer_blocked']?></a></td>
171 </tr>
172 <tr>
173 <td class="DataTD"><?=_("Account Locking")?>:</td>
174 <td class="DataTD"><a href="account.php?id=43&amp;locked=<?=$row['id']?>&amp;csrf=<?=make_csrf('admactlock')?>"><?=$row['locked']?></a></td>
175 </tr>
176 <tr>
177 <td class="DataTD"><?=_("Code Signing")?>:</td>
178 <td class="DataTD"><a href="account.php?id=43&amp;codesign=<?=$row['id']?>&amp;csrf=<?=make_csrf('admcodesign')?>"><?=$row['codesign']?></a></td>
179 </tr>
180 <tr>
181 <td class="DataTD"><?=_("Org Admin")?>:</td>
182 <td class="DataTD"><a href="account.php?id=43&amp;orgadmin=<?=$row['id']?>&amp;csrf=<?=make_csrf('admorgadmin')?>"><?=$row['orgadmin']?></a></td>
183 </tr>
184 <tr>
185 <td class="DataTD"><?=_("TTP Admin")?>:</td>
186 <td class="DataTD"><a href="account.php?id=43&amp;ttpadmin=<?=$row['id']?>&amp;csrf=<?=make_csrf('admttpadmin')?>"><?=$row['ttpadmin']?></a></td>
187 </tr>
188 <tr>
189 <td class="DataTD"><?=_("Location Admin")?>:</td>
190 <td class="DataTD"><a href="account.php?id=43&amp;locadmin=<?=$row['id']?>"><?=$row['locadmin']?></a></td>
191 </tr>
192 <tr>
193 <td class="DataTD"><?=_("Admin")?>:</td>
194 <td class="DataTD"><a href="account.php?id=43&amp;admin=<?=$row['id']?>&amp;csrf=<?=make_csrf('admsetadmin')?>"><?=$row['admin']?></a></td>
195 </tr>
196 <tr>
197 <td class="DataTD"><?=_("Ad Admin")?>:</td>
198 <td class="DataTD"><a href="account.php?id=43&amp;adadmin=<?=$row['id']?>"><?=$row['adadmin']?></a> (0 = none, 1 = submit, 2 = approve)</td>
199 </tr>
200 <tr>
201 <td class="DataTD"><?=_("Tverify Account")?>:</td>
202 <td class="DataTD"><a href="account.php?id=43&amp;tverify=<?=$row['id']?>"><?=$row['tverify']?></a></td>
203 </tr>
204 <tr>
205 <td class="DataTD"><?=_("General Announcements")?>:</td>
206 <td class="DataTD"><a href="account.php?id=43&amp;general=<?=$row['id']?>"><?=$alerts['general']?></a></td>
207 </tr>
208 <tr>
209 <td class="DataTD"><?=_("Country Announcements")?>:</td>
210 <td class="DataTD"><a href="account.php?id=43&amp;country=<?=$row['id']?>"><?=$alerts['country']?></a></td>
211 </tr>
212 <tr>
213 <td class="DataTD"><?=_("Regional Announcements")?>:</td>
214 <td class="DataTD"><a href="account.php?id=43&amp;regional=<?=$row['id']?>"><?=$alerts['regional']?></a></td>
215 </tr>
216 <tr>
217 <td class="DataTD"><?=_("Within 200km Announcements")?>:</td>
218 <td class="DataTD"><a href="account.php?id=43&amp;radius=<?=$row['id']?>"><?=$alerts['radius']?></a></td>
219 </tr>
220 <tr>
221 <td class="DataTD"><?=_("Change Password")?>:</td>
222 <td class="DataTD"><a href="account.php?id=44&amp;userid=<?=$row['id']?>"><?=_("Change Password")?></a></td>
223 </tr>
224 <tr>
225 <td class="DataTD"><?=_("Delete Account")?>:</td>
226 <td class="DataTD"><a href="account.php?id=50&amp;userid=<?=$row['id']?>&amp;csrf=<?=make_csrf('admdelaccount')?>"><?=_("Delete Account")?></a></td>
227 </tr>
228 <?
229 // This is intensionally a $_GET for audit purposes. DO NOT CHANGE!!!
230 if(array_key_exists('showlostpw',$_GET) && $_GET['showlostpw'] == "yes") {
231 ?>
232 <tr>
233 <td class="DataTD"><?=_("Lost Password")?> - Q1:</td>
234 <td class="DataTD"><?=sanitizeHTML($row['Q1'])?></td>
235 </tr>
236 <tr>
237 <td class="DataTD"><?=_("Lost Password")?> - A1:</td>
238 <td class="DataTD"><?=sanitizeHTML($row['A1'])?></td>
239 </tr>
240 <tr>
241 <td class="DataTD"><?=_("Lost Password")?> - Q2:</td>
242 <td class="DataTD"><?=sanitizeHTML($row['Q2'])?></td>
243 </tr>
244 <tr>
245 <td class="DataTD"><?=_("Lost Password")?> - A2:</td>
246 <td class="DataTD"><?=sanitizeHTML($row['A2'])?></td>
247 </tr>
248 <tr>
249 <td class="DataTD"><?=_("Lost Password")?> - Q3:</td>
250 <td class="DataTD"><?=sanitizeHTML($row['Q3'])?></td>
251 </tr>
252 <tr>
253 <td class="DataTD"><?=_("Lost Password")?> - A3:</td>
254 <td class="DataTD"><?=sanitizeHTML($row['A3'])?></td>
255 </tr>
256 <tr>
257 <td class="DataTD"><?=_("Lost Password")?> - Q4:</td>
258 <td class="DataTD"><?=sanitizeHTML($row['Q4'])?></td>
259 </tr>
260 <tr>
261 <td class="DataTD"><?=_("Lost Password")?> - A4:</td>
262 <td class="DataTD"><?=sanitizeHTML($row['A4'])?></td>
263 </tr>
264 <tr>
265 <td class="DataTD"><?=_("Lost Password")?> - Q5:</td>
266 <td class="DataTD"><?=sanitizeHTML($row['Q5'])?></td>
267 </tr>
268 <tr>
269 <td class="DataTD"><?=_("Lost Password")?> - A5:</td>
270 <td class="DataTD"><?=sanitizeHTML($row['A5'])?></td>
271 </tr>
272 <? } else { ?>
273 <tr>
274 <td class="DataTD" colspan="2"><a href="account.php?id=43&amp;userid=<?=$row['id']?>&amp;showlostpw=yes"><?=_("Show Lost Password Details")?></a></td>
275 </tr>
276 <? } ?>
277 <tr>
278 <td class="DataTD"><?=_("Assurance Points")?>:</td>
279 <td class="DataTD"><?=intval($drow['points'])?></td>
280 </tr>
281 </table>
282 <br><?
283 $query = "select * from `email` where `memid`='".intval($row['id'])."' and `deleted`=0 and `hash`=''
284 and `email`!='".mysql_escape_string($row['email'])."'";
285 $dres = mysql_query($query);
286 if(mysql_num_rows($dres) > 0) { ?>
287 <table align="center" valign="middle" border="0" cellspacing="0" cellpadding="0" class="wrapper">
288 <tr>
289 <td colspan="5" class="title"><?=_("Alternate Verified Email Addresses")?></td>
290 </tr><?
291 $rc = mysql_num_rows($dres);
292 while($drow = mysql_fetch_assoc($dres))
293 { ?>
294 <tr>
295 <td class="DataTD"><?=_("Secondary Emails")?>:</td>
296 <td class="DataTD"><?=sanitizeHTML($drow['email'])?></td>
297 </tr>
298 <? } ?>
299 </table>
300 <br><? } ?>
301 <?
302 $query = "select * from `domains` where `memid`='".intval($row['id'])."' and `deleted`=0 and `hash`=''";
303 $dres = mysql_query($query);
304 if(mysql_num_rows($dres) > 0) { ?>
305 <table align="center" valign="middle" border="0" cellspacing="0" cellpadding="0" class="wrapper">
306 <tr>
307 <td colspan="5" class="title"><?=_("Verified Domains")?></td>
308 </tr><?
309 $rc = mysql_num_rows($dres);
310 while($drow = mysql_fetch_assoc($dres))
311 { ?>
312 <tr>
313 <td class="DataTD"><?=_("Domain")?>:</td>
314 <td class="DataTD"><?=sanitizeHTML($drow['domain'])?></td>
315 </tr>
316 <? } ?>
317 </table>
318 <br>
319 <? } ?>
320
321 <?
322 if(array_key_exists('assuredto',$_GET) && $_GET['assuredto'] == "yes") {
323 ?>
324
325 <table align="center" valign="middle" border="0" cellspacing="0" cellpadding="0" class="wrapper">
326 <tr>
327 <td colspan="7" class="title"><?=_("Assurance Points")?></td>
328 </tr>
329 <tr>
330 <td class="DataTD"><b><?=_("Date")?></b></td>
331 <td class="DataTD"><b><?=_("Who")?></b></td>
332 <td class="DataTD"><b><?=_("Email")?></b></td>
333 <td class="DataTD"><b><?=_("Points")?></b></td>
334 <td class="DataTD"><b><?=_("Location")?></b></td>
335 <td class="DataTD"><b><?=_("Method")?></b></td>
336 <td class="DataTD"><b><?=_("Revoke")?></b></td>
337 </tr>
338 <?
339 $query = "select * from `notary` where `to`='".intval($row['id'])."'";
340 $dres = mysql_query($query);
341 $points = 0;
342 while($drow = mysql_fetch_assoc($dres))
343 {
344 $fromuser = mysql_fetch_assoc(mysql_query("select * from `users` where `id`='".intval($drow['from'])."'"));
345 $points += $drow['points'];
346 ?>
347 <tr>
348 <td class="DataTD"><?=sanitizeHTML($drow['date'])?></td>
349 <td class="DataTD"><a href="wot.php?id=9&amp;userid=<?=intval($drow['from'])?>"><?=sanitizeHTML($fromuser['fname'])." ".sanitizeHTML($fromuser['lname'])?></td>
350 <td class="DataTD"><a href="account.php?id=43&amp;userid=<?=intval($drow['to'])?>"><?=sanitizeHTML($fromuser['email'])?></a></td>
351 <td class="DataTD"><?=intval($drow['points'])?></td>
352 <td class="DataTD"><?=sanitizeHTML($drow['location'])?></td>
353 <td class="DataTD"><?=sanitizeHTML($drow['method'])?></td>
354 <td class="DataTD"><a href="account.php?id=43&amp;userid=<?=intval($drow['to'])?>&amp;assurance=<?=intval($drow['id'])?>&amp;csrf=<?=make_csrf('admdelassurance')?>" onclick="return confirm('<?=_("Are you sure you want to revoke this assurance?")?>');"><?=_("Revoke")?></a></td>
355 </tr>
356 <? } ?>
357 <tr>
358 <td class="DataTD" colspan="2"><b><?=_("Total Points")?>:</b></td>
359 <td class="DataTD"><?=$points?></td>
360 <td class="DataTD" colspan="3">&nbsp;</td>
361 </tr>
362 </table>
363 <? } else { ?>
364 <tr>
365 <td class="DataTD" colspan="2"><a href="account.php?id=43&amp;userid=<?=$row['id']?>&amp;assuredto=yes"><?=_("Show Assurances the user got")?></a></td>
366 </tr>
367 <? } ?>
368 <br>
369 <?
370 if(array_key_exists('assuredby',$_GET) && $_GET['assuredby'] == "yes") {
371 ?>
372 <table align="center" valign="middle" border="0" cellspacing="0" cellpadding="0" class="wrapper">
373 <tr>
374 <td colspan="7" class="title"><?=_("Assurance Points The User Issued")?></td>
375 </tr>
376 <tr>
377 <td class="DataTD"><b><?=_("Date")?></b></td>
378 <td class="DataTD"><b><?=_("Who")?></b></td>
379 <td class="DataTD"><b><?=_("Email")?></b></td>
380 <td class="DataTD"><b><?=_("Points")?></b></td>
381 <td class="DataTD"><b><?=_("Location")?></b></td>
382 <td class="DataTD"><b><?=_("Method")?></b></td>
383 <td class="DataTD"><b><?=_("Revoke")?></b></td>
384 </tr>
385 <?
386 $query = "select * from `notary` where `from`='".$row['id']."' and `to`!='".$row['id']."'";
387 $dres = mysql_query($query);
388 $points = 0;
389 while($drow = mysql_fetch_assoc($dres))
390 {
391 $fromuser = mysql_fetch_assoc(mysql_query("select * from `users` where `id`='".$drow['to']."'"));
392 $points += $drow['points'];
393 ?>
394 <tr>
395 <td class="DataTD"><?=$drow['date']?></td>
396 <td class="DataTD"><a href="wot.php?id=9&userid=<?=$drow['to']?>"><?=$fromuser['fname']." ".$fromuser['lname']?></td>
397 <td class="DataTD"><a href="account.php?id=43&amp;userid=<?=intval($drow['to'])?>"><?=sanitizeHTML($fromuser['email'])?></a></td>
398 <td class="DataTD"><?=$drow['points']?></td>
399 <td class="DataTD"><?=$drow['location']?></td>
400 <td class="DataTD"><?=$drow['method']?></td>
401 <td class="DataTD"><a href="account.php?id=43&userid=<?=$drow['from']?>&assurance=<?=$drow['id']?>&amp;csrf=<?=make_csrf('admdelassurance')?>" onclick="return confirm('<?=_("Are you sure you want to revoke this assurance?")?>');"><?=_("Revoke")?></a></td>
402 </tr>
403 <? } ?>
404 <tr>
405 <td class="DataTD" colspan="2"><b><?=_("Total Points")?>:</b></td>
406 <td class="DataTD"><?=$points?></td>
407 <td class="DataTD" colspan="3">&nbsp;</td>
408 </tr>
409 </table>
410 <? } else { ?>
411 <tr>
412 <td class="DataTD" colspan="2"><a href="account.php?id=43&amp;userid=<?=$row['id']?>&amp;assuredby=yes"><?=_("Show Assurances the user gave")?></a></td>
413 </tr>
414 <? } ?>
415 <br><br>
416 <? } } ?>
417