All mysql_-statments replaced by their corresponding mysqli_-statements
[cacert-devel.git] / pages / wot / 1.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 $res=mysqli_fetch_assoc(mysqli_query($_SESSION['mconn'], "select sum(acount) as summe from countries"));
20 $total1 =$res['summe'];
21
22 $locid=array_key_exists('locid',$_REQUEST)?intval($_REQUEST['locid']):0;
23 $regid=array_key_exists('regid',$_REQUEST)?intval($_REQUEST['regid']):0;
24 $ccid=array_key_exists('ccid',$_REQUEST)?intval($_REQUEST['ccid']):0;
25
26 echo "<ul class='top'>\n<li>";
27 echo "<a href='wot.php?id=1'>"._("Home")." ("._("Listed").": $total1)</a>\n";
28
29 $display = "";
30 if($locid > 0)
31 {
32 $loc = mysqli_fetch_assoc(mysqli_query($_SESSION['mconn'], "select * from `locations` where `id`='".$locid."'"));
33 $display = "<ul class='top'>\n<li>\n".
34 "<a href='wot.php?id=1&locid=".$locid."'>".$loc['name']." ("._("Listed").": ".$loc['acount'].")</a>\n".
35 $display;
36 $regid = $loc['regid'];
37 }
38
39 if($regid > 0)
40 {
41 $reg = mysqli_fetch_assoc(mysqli_query($_SESSION['mconn'], "select * from `regions` where `id`='".$regid."'"));
42 $display = "<ul class='top'>\n<li>\n".
43 "<a href='wot.php?id=1&regid=".$regid."'>".$reg['name']." ("._("Listed").": ".$reg['acount'].")</a>\n".
44 $display;
45 $ccid = $reg['ccid'];
46 }
47
48 if($ccid > 0)
49 {
50 $cnt = mysqli_fetch_assoc(mysqli_query($_SESSION['mconn'], "select * from `countries` where `id`='".$ccid."'"));
51 $display = "<ul class='top'>\n<li>\n".
52 "<a href='wot.php?id=1&ccid=".$ccid."'>".$cnt['name']." ("._("Listed").": ".$cnt['acount'].")</a>\n".
53 $display;
54 }
55
56 if($display)
57 echo $display;
58
59 if($ccid <= 0)
60 {
61 echo "<ul>\n";
62 $query = "select * from countries where acount>0 order by `name`";
63 $res = mysqli_query($_SESSION['mconn'], $query);
64 while($row = mysqli_fetch_assoc($res))
65 {
66 echo "<li><a href='wot.php?id=1&ccid=".$row['id']."'>".$row['name']." ("._("Listed").": ".$row['acount'].")</a></li>\n";
67 }
68 echo "</ul>\n</li>\n</ul>\n<br>\n";
69 } elseif($ccid > 0 && $regid <= 0 && $locid <= 0) {
70 echo "<ul>\n";
71 $query = "select * from regions where ccid='".$ccid."' and acount>0 order by `name`";
72 $res = mysqli_query($_SESSION['mconn'], $query);
73 while($row = mysqli_fetch_assoc($res))
74 {
75 echo "<li><a href='wot.php?id=1&regid=".$row['id']."'>".$row['name']." ("._("Listed").": ".$row['acount'].")</a></li>\n";
76 }
77 echo "</ul>\n</li>\n</ul>\n</li>\n</ul>\n<br>\n";
78 } elseif($regid > 0 && $locid <= 0) {
79 echo "<ul>\n";
80 $query = "select * from locations where regid='".$regid."' and acount>0 order by `name`";
81 $res = mysqli_query($_SESSION['mconn'], $query);
82 while($row = mysqli_fetch_assoc($res))
83 {
84 echo "<li><a href='wot.php?id=1&locid=".$row['id']."'>".$row['name']." ("._("Listed").": ".$row['acount'].")</a></li>\n";
85 }
86 echo "</ul>\n</li>\n</ul>\n</li>\n</ul>\n<br>\n";
87 } elseif($locid > 0){
88 echo "</ul>\n</li>\n</ul>\n</li>\n</ul>\n</li>\n</ul>\n<br>\n";
89 }
90 if($locid>0 || $regid>0 || $ccid>0)
91 {
92 $query = "select *, `users`.`id` as `id` from `users`,`notary` where `listme`='1' and
93 `ccid`='".$ccid."' and `regid`='".$regid."' and
94 `locid`='".$locid."' and `users`.`id`=`notary`.`to` and `notary`.`deleted`=0
95 group by `notary`.`to` HAVING SUM(`points`) >= 100 order by `points` desc";
96 $list = mysqli_query($_SESSION['mconn'], $query);
97 if(mysqli_num_rows($list) > 0)
98 {
99 ?>
100 <table align="center" valign="middle" border="0" cellspacing="0" cellpadding="0" class="wrapper" width="550">
101 <tr>
102 <td class="title"><?=_("Name")?></td>
103 <td class="title"><?=_("Max Points")?></td>
104 <td class="title"><?=_("Contact Details")?></td>
105 <td class="title"><?=_("Email Assurer")?></td>
106 <td class="title"><?=_("Assurer Challenge")?></td>
107 </tr>
108
109 <? while($row = mysqli_fetch_assoc($list)) { ?>
110 <tr>
111 <td class="DataTD" width="100"><nobr><?=sanitizeHTML($row['fname'])?> <?=substr($row['lname'], 0, 1)?>.</nobr></td>
112 <td class="DataTD"><?=maxpoints($row['id'])?></td>
113 <td class="DataTD"><?=sanitizeHTML($row['contactinfo'])?></td>
114 <td class="DataTD"><a href="wot.php?id=9&amp;userid=<?=intval($row['id'])?>"><?=_("Email Me")?></a></td>
115 <td class="DataTD"><?=$row['assurer']?_("Yes"):("<font color=\"#ff0000\">"._("Not yet!")."</font>")?></td>
116 </tr>
117 <?
118 }
119 }
120 ?>
121 </table>
122 <br>
123 <? } ?>