cacert-webdb/pages/wot/1.php

139 lines
6.1 KiB
PHP
Raw Normal View History

2004-10-16 00:28:17 +00:00
<? /*
Copyright (C) 2004 by Duane Groth <duane_at_CAcert_dot_org>
This file is part of CAcert.
CAcert has been released under the CAcert Source License
which can be found included with these source files or can
be downloaded from the internet from the following address:
http://www.cacert.org/src-lic.php
CAcert is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE. See the License for more details.
*/ ?>
<?
$total1 = mysql_num_rows(mysql_query("select * from `users`,`notary` where `listme`='1' and `users`.`id`=`notary`.`to`
group by `notary`.`to` HAVING SUM(`points`) >= 100"));
$total4 = mysql_num_rows(mysql_query("select * from `users`,`notary` where `listme`='1' and
`locid`='".$_GET['locid']."' and `users`.`id`=`notary`.`to`
group by `notary`.`to` HAVING SUM(`points`) >= 100"));
echo "<ul class='top'>\n<li>";
echo "<a href='wot.php?id=1'>"._("Home")." ("._("Listed").": $total1)</a>\n";
$display = "";
if(intval($_GET['locid']) > 0)
{
$loc = mysql_fetch_assoc(mysql_query("select * from `locations` where `id`='".$_GET['locid']."'"));
$display = "<ul class='top'>\n<li>\n".
2005-11-08 10:06:04 +00:00
"<a href='wot.php?id=1&locid=".$_GET['locid']."'>$loc[name] ("._("Listed").": $total4)</a>\n".
2004-10-16 00:28:17 +00:00
$display;
$_GET['regid'] = $loc['regid'];
}
if(intval($_GET['regid']) > 0)
{
$total3 = mysql_num_rows(mysql_query("select * from `users`,`notary` where `listme`='1' and
`regid`='".$_GET['regid']."' and `users`.`id`=`notary`.`to`
group by `notary`.`to` HAVING SUM(`points`) >= 100"));
$reg = mysql_fetch_assoc(mysql_query("select * from `regions` where `id`='".$_GET['regid']."'"));
$display = "<ul class='top'>\n<li>\n".
2005-11-08 10:06:04 +00:00
"<a href='wot.php?id=1&regid=".$_GET['regid']."'>$reg[name] ("._("Listed").": $total3)</a>\n".
2004-10-16 00:28:17 +00:00
$display;
$_GET['ccid'] = $reg['ccid'];
}
if(intval($_GET['ccid']) > 0)
{
$total2 = mysql_num_rows(mysql_query("select * from `users`,`notary` where `listme`='1' and
`ccid`='".$_GET['ccid']."' and `users`.`id`=`notary`.`to`
group by `notary`.`to` HAVING SUM(`points`) >= 100"));
$cnt = mysql_fetch_assoc(mysql_query("select * from `countries` where `id`='".$_GET['ccid']."'"));
$display = "<ul class='top'>\n<li>\n".
2005-11-08 10:06:04 +00:00
"<a href='wot.php?id=1&ccid=".$_GET['ccid']."'>$cnt[name] ("._("Listed").": $total2)</a>\n".
2004-10-16 00:28:17 +00:00
$display;
}
if($display)
echo $display;
if(intval($_GET['ccid']) <= 0)
{
echo "<ul>\n";
2005-11-08 10:06:04 +00:00
$res = mysql_query("select distinct `ccid`,`countries`.`name` from `users`,`notary`,`countries` where `listme`='1' and `ccid` > 0 and
2005-03-20 17:07:33 +00:00
`users`.`id`=`notary`.`to` and `ccid`=`countries`.`id` group by `notary`.`to` HAVING SUM(`points`) >= 100
2005-11-08 10:06:04 +00:00
order by `countries`.`name`");
2004-10-16 00:28:17 +00:00
while($row = mysql_fetch_assoc($res))
{
2005-05-13 15:34:39 +00:00
$query = "select sum(`users`.`id`) as `listed` from `users`,`notary`
where `listme`='1' and `ccid` = '$row[ccid]' and `users`.`id`=`notary`.`to`
group by `notary`.`to` HAVING SUM(`points`) >= 100";
$listed = mysql_num_rows(mysql_query($query));
2005-11-08 10:06:04 +00:00
echo "<li><a href='wot.php?id=1&ccid=$row[ccid]'>$row[name] ("._("Listed").": $listed)</a></li>\n";
2004-10-16 00:28:17 +00:00
}
2005-03-20 17:07:33 +00:00
2004-10-16 00:28:17 +00:00
echo "</ul>\n</li>\n</ul>\n<br>\n";
} elseif(intval($_GET['ccid']) > 0 && intval($_GET['regid']) <= 0 && intval($_GET['locid']) <= 0) {
echo "<ul>\n";
2005-11-08 10:06:04 +00:00
$query = "select distinct `regid`,`regions`.`name` from `users`,`notary`,`regions` where `listme`='1' and `users`.`id`=`notary`.`to` and
2005-03-20 17:07:33 +00:00
`regid`=`regions`.`id` and `users`.`ccid`='".$_GET['ccid']."' group by `notary`.`to`
2005-11-08 10:06:04 +00:00
HAVING SUM(`points`) >= 100 order by `regions`.`name`";
2004-10-16 00:28:17 +00:00
$res = mysql_query($query);
while($row = mysql_fetch_assoc($res))
{
2005-05-13 15:34:39 +00:00
$query = "select sum(`users`.`id`) as `listed` from `users`,`notary`
where `listme`='1' and `regid` = '$row[regid]' and `users`.`id`=`notary`.`to`
group by `notary`.`to` HAVING SUM(`points`) >= 100";
$listed = mysql_num_rows(mysql_query($query));
2005-11-08 10:06:04 +00:00
echo "<li><a href='wot.php?id=1&regid=$row[regid]'>$row[name] ("._("Listed").": $listed)</a></li>\n";
2004-10-16 00:28:17 +00:00
}
echo "</ul>\n</li>\n</ul>\n</li>\n</ul>\n<br>\n";
} elseif(intval($_GET['regid']) > 0 && intval($_GET['locid']) <= 0) {
echo "<ul>\n";
$query = "select * from `users`,`notary` where `listme`='1' and `regid`='".$_GET['regid']."' and
`users`.`id`=`notary`.`to` group by `locid` HAVING SUM(`points`) >= 100";
$res = mysql_query($query);
while($row = mysql_fetch_assoc($res))
{
$loc = mysql_fetch_assoc(mysql_query("select * from `locations` where `id`='$row[locid]'"));
$listed = mysql_num_rows(mysql_query("select * from `users`,`notary` where `listme`='1' and
`locid`='".$row['locid']."' and `locid`!=0 and `users`.`id`=`notary`.`to`
group by `notary`.`to` HAVING SUM(`points`) >= 100"));
if($listed > 0)
2005-11-08 10:06:04 +00:00
echo "<li><a href='wot.php?id=1&locid=$loc[id]'>$loc[name] ("._("Listed").": $listed)</a></li>\n";
2004-10-16 00:28:17 +00:00
}
echo "</ul>\n</li>\n</ul>\n</li>\n</ul>\n<br>\n";
} elseif(intval($_GET['locid']) > 0){
echo "</ul>\n</li>\n</ul>\n</li>\n</ul>\n</li>\n</ul>\n<br>\n";
}
2005-11-08 10:06:04 +00:00
$query = "select *, `users`.`id` as `id` from `users`,`notary` where `listme`='1' and
2004-10-16 00:28:17 +00:00
`ccid`='".intval($_GET['ccid'])."' and `regid`='".intval($_GET['regid'])."' and
`locid`='".intval($_GET['locid'])."' and `users`.`id`=`notary`.`to`
group by `notary`.`to` HAVING SUM(`points`) >= 100 order by `points` desc";
$list = mysql_query($query);
if(mysql_num_rows($list) > 0)
{
?>
<table align="center" valign="middle" border="0" cellspacing="0" cellpadding="0" class="wrapper" width="550">
<tr>
<td class="title"><?=_("Name")?></td>
<td class="title"><?=_("Max Points")?></td>
<td class="title"><?=_("Contact Details")?></td>
2004-10-24 01:46:49 +00:00
<td class="title"><?=_("Email Assurer")?></td>
2004-10-16 00:28:17 +00:00
</tr>
<? while($row = mysql_fetch_assoc($list)) { ?>
<tr>
2005-11-08 10:06:04 +00:00
<td class="DataTD" width="100"><nobr><?=$row['fname']?> <?=substr($row['lname'], 0, 1)?></nobr></td>
2004-10-16 00:28:17 +00:00
<td class="DataTD"><?=maxpoints($row['id'])?></td>
<td class="DataTD"><?=$row['contactinfo']?></td>
2005-05-25 03:41:55 +00:00
<td class="DataTD"><a href="wot.php?id=9&userid=<?=$row['id']?>"><?=_("Email Me")?></a></td>
2004-10-16 00:28:17 +00:00
</tr>
<? } ?>
</table>
<br>
<? } ?>