cacert-webdb/pages/wot/7-old.php

184 lines
7 KiB
PHP
Raw Normal View History

2004-10-16 00:28:17 +00:00
<? /*
2008-04-06 19:45:09 +00:00
LibreSSL - CAcert web application
Copyright (C) 2004-2008 CAcert Inc.
2004-10-16 00:28:17 +00:00
2008-04-06 19:45:09 +00:00
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
2004-10-16 00:28:17 +00:00
2008-04-06 19:45:09 +00:00
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
2004-10-16 00:28:17 +00:00
2008-04-06 19:45:09 +00:00
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
2004-10-16 00:28:17 +00:00
*/ ?>
<?
2006-03-05 11:18:16 +00:00
exit;
2004-10-16 00:28:17 +00:00
if($_GET['action'] != "update")
{
$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"));
$town = mysql_escape_string(stripslashes($_GET['town']));
2004-10-16 00:28:17 +00:00
$start = intval($_GET['start']);
$limit = 25;
echo "<div id='listshow'><ul class='top'>\n<li>";
echo "<a href='wot.php?id=7'>"._("Home")." ("._("Listed").": $total1)</a>\n";
$display = "";
2007-07-03 20:00:18 +00:00
$ccid=intval($_GET['ccid']);
$locid=intval($_GET['locid']);
$regid=intval($_GET['regid']);
if($locid > 0)
2004-10-16 00:28:17 +00:00
{
2007-07-03 20:00:18 +00:00
$total4 = mysql_num_rows(mysql_query("select * from `users`,`notary` where `listme`='1' and `locid`='".$locid."' and
2004-10-16 00:28:17 +00:00
`users`.`id`=`notary`.`to` group by `notary`.`to` HAVING SUM(`points`) >= 100"));
2007-07-03 20:00:18 +00:00
$loc = mysql_fetch_assoc(mysql_query("select * from `locations` where `id`='".$locid."'"));
2004-10-16 00:28:17 +00:00
$display = "<ul class='top'>\n<li>\n".
2007-07-03 20:00:18 +00:00
"<a href='wot.php?id=7&locid=".$locid."'>$loc[name] ("._("Listed").": $total4)</a>\n".
2004-10-16 00:28:17 +00:00
$display;
2007-07-03 20:00:18 +00:00
$regid = $loc['regid'];
2004-10-16 00:28:17 +00:00
}
2007-07-03 20:00:18 +00:00
if($regid > 0)
2004-10-16 00:28:17 +00:00
{
2007-07-03 20:00:18 +00:00
$total3 = mysql_num_rows(mysql_query("select * from `users`,`notary` where `listme`='1' and `regid`='".$regid."' and
2004-10-16 00:28:17 +00:00
`users`.`id`=`notary`.`to` group by `notary`.`to` HAVING SUM(`points`) >= 100"));
2007-07-03 20:00:18 +00:00
$reg = mysql_fetch_assoc(mysql_query("select * from `regions` where `id`='".$regid."'"));
2004-10-16 00:28:17 +00:00
$display = "<ul class='top'>\n<li>\n".
2007-07-03 20:00:18 +00:00
"<a href='wot.php?id=7&regid=".$regid."'>$reg[name] ("._("Listed").": $total3)</a>\n".
2004-10-16 00:28:17 +00:00
$display;
2007-07-03 20:00:18 +00:00
$ccid = $reg['ccid'];
2004-10-16 00:28:17 +00:00
}
2007-07-03 20:00:18 +00:00
if($ccid > 0)
2004-10-16 00:28:17 +00:00
{
$total2 = mysql_num_rows(mysql_query("select * from `users`,`notary` where `listme`='1' and
2007-07-03 20:00:18 +00:00
`ccid`='".$ccid."' and `users`.`id`=`notary`.`to`
2004-10-16 00:28:17 +00:00
group by `notary`.`to` HAVING SUM(`points`) >= 100"));
2007-07-03 20:00:18 +00:00
$cnt = mysql_fetch_assoc(mysql_query("select * from `countries` where `id`='".$ccid."'"));
2004-10-16 00:28:17 +00:00
$display = "<ul class='top'>\n<li>\n".
2007-07-03 20:00:18 +00:00
"<a href='wot.php?id=7&ccid=".$ccid."'>$cnt[name] ("._("Listed").": $total2)</a>\n".
2004-10-16 00:28:17 +00:00
$display;
}
if($display)
echo $display;
2007-07-03 20:00:18 +00:00
if($ccid <= 0)
2004-10-16 00:28:17 +00:00
{
echo "<ul>\n";
2005-11-08 10:06:04 +00:00
$query = "select * from `countries` order by `name`";
2004-10-16 00:28:17 +00:00
$res = mysql_query($query);
while($row = mysql_fetch_assoc($res))
2005-11-08 10:06:04 +00:00
echo "<li><a href='wot.php?id=7&ccid=$row[id]'>$row[name]</a></li>\n";
2004-10-16 00:28:17 +00:00
echo "</ul>\n</li>\n</ul></div>\n<br>\n";
2007-07-03 20:00:18 +00:00
} elseif($regid <= 0) {
2004-10-16 00:28:17 +00:00
echo "<ul>\n";
2007-07-03 20:00:18 +00:00
$query = "select * from `regions` where `ccid`='".$ccid."' order by `name`";
2004-10-16 00:28:17 +00:00
$res = mysql_query($query);
while($row = mysql_fetch_assoc($res))
2005-11-08 10:06:04 +00:00
echo "<li><a href='wot.php?id=7&regid=$row[id]'>$row[name]</a></li>\n";
2004-10-16 00:28:17 +00:00
echo "</ul>\n</li>\n</ul>\n</li>\n</ul></div>\n<br>\n";
2007-07-03 20:00:18 +00:00
} elseif($locid <= 0) {
2004-10-16 00:28:17 +00:00
echo "<ul>\n";
if($town != "")
{
2007-07-03 20:00:18 +00:00
$query = "select * from `locations` where `regid`='".$regid."' and `name` < '$town'";
2004-10-16 00:28:17 +00:00
$start = mysql_num_rows(mysql_query($query));
}
2007-07-03 20:00:18 +00:00
$query = "select * from `locations` where `regid`='".$regid."' order by `name` limit $start, $limit";
2004-10-16 00:28:17 +00:00
$res = mysql_query($query);
while($row = mysql_fetch_assoc($res))
2005-11-08 10:06:04 +00:00
echo "<li><a href='wot.php?id=7&locid=$row[id]'>$row[name]</a></li>\n";
2004-10-16 00:28:17 +00:00
echo "</ul>\n</li>\n</ul>\n</li>\n</ul></div>\n<br>\n";
2007-07-03 20:00:18 +00:00
$rc = mysql_num_rows(mysql_query("select * from `locations` where `regid`='".$regid."'"));
2004-10-16 00:28:17 +00:00
if($start > 0)
{
$prev = $start - $limit;
if($prev < 0)
$prev = 0;
2007-07-03 20:00:18 +00:00
$st = "[ <a href='wot.php?id=7&regid=".$regid."'><< Start</a> ] ";
$prev = "[ <a href='wot.php?id=7&regid=".$regid."&start=$prev'>< Previous $limit</a> ] ";
2004-10-16 00:28:17 +00:00
}
if($start < $rc - $limit)
{
$next = $start + $limit;
$last = $rc - $limit;
2007-07-03 20:00:18 +00:00
$next = "[ <a href='wot.php?id=7&regid=".$regid."&start=$next'>Next $limit ></a> ] ";
$end = "[ <a href='wot.php?id=7&regid=".$regid."&start=$last'>End >></a> ]";
2004-10-16 00:28:17 +00:00
}
echo "<div id='search1'>$st</div><div id='search3'>$end</div>\n";
echo "<div id='search2'>$prev</div><div id='search4'>$next</div>\n";
?>
<div align="left">
<form method="get" action="wot.php">
<table align="center" valign="middle" border="0" cellspacing="0" cellpadding="0" class="wrapper" width="200">
<tr>
<td colspan="2" class="title"><?=_("Search this region")?></td>
</tr>
<tr>
<td class="DataTD" width="125"><?=_("Location Name")?>: </td>
2007-07-03 20:00:18 +00:00
<td class="DataTD" width="125"><input type="text" name="town" value="<?=sanitizeHTML($_GET['town'])?>" size="10"></td>
2004-10-16 00:28:17 +00:00
</tr>
<tr>
<td class="DataTD" colspan="2"><input type="submit" name="process" value="<?=_("Search")?>"></td>
</tr>
</table>
2007-07-03 20:00:18 +00:00
<input type="hidden" name="regid" value="<?=$regid?>">
2004-10-16 00:28:17 +00:00
<input type="hidden" name="id" value="7">
</form>
</div>
<?
} else {
echo "</ul>\n</li>\n</ul>\n</li>\n</ul>\n</li>\n</ul>\n<br>\n";
2007-07-03 20:00:18 +00:00
echo "<p><a href='wot.php?id=7&action=update&locid=".$locid."'>";
2004-10-16 00:28:17 +00:00
echo _("Make my location here");
echo "</a></p>\n";
echo "<p>"._("If you are happy with this location, click 'Make my location here' to update your location details.")."</p><br>\n";
}
} else {
$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"));
2007-07-03 20:00:18 +00:00
if($locid > 0)
2004-10-16 00:28:17 +00:00
{
2007-07-03 20:00:18 +00:00
$total4 = mysql_num_rows(mysql_query("select * from `users`,`notary` where `listme`='1' and `locid`='".$locid."' and
2004-10-16 00:28:17 +00:00
`users`.`id`=`notary`.`to` group by `notary`.`to` HAVING SUM(`points`) >= 100"));
2007-07-03 20:00:18 +00:00
$loc = mysql_fetch_assoc(mysql_query("select * from `locations` where `id`='".$locid."'"));
$regid = $loc['regid'];
2004-10-16 00:28:17 +00:00
}
2007-07-03 20:00:18 +00:00
if($regid) > 0)
2004-10-16 00:28:17 +00:00
{
2007-07-03 20:00:18 +00:00
$total3 = mysql_num_rows(mysql_query("select * from `users`,`notary` where `listme`='1' and `regid`='".$regid."' and
2004-10-16 00:28:17 +00:00
`users`.`id`=`notary`.`to` group by `notary`.`to` HAVING SUM(`points`) >= 100"));
2007-07-03 20:00:18 +00:00
$reg = mysql_fetch_assoc(mysql_query("select * from `regions` where `id`='".$regid."'"));
$ccid = $reg['ccid'];
2004-10-16 00:28:17 +00:00
}
$total2 = mysql_num_rows(mysql_query("select * from `users`,`notary` where `listme`='1' and
2007-07-03 20:00:18 +00:00
`ccid`='".$ccid."' and `users`.`id`=`notary`.`to`
2004-10-16 00:28:17 +00:00
group by `notary`.`to` HAVING SUM(`points`) >= 100"));
2007-07-03 20:00:18 +00:00
$_SESSION['profile']['ccid'] = $ccid;
$_SESSION['profile']['regid'] = $regid;
$_SESSION['profile']['locid'] = $locid;
2004-10-16 00:28:17 +00:00
2007-07-03 20:00:18 +00:00
mysql_query("update `users` set `ccid`='".$ccid."',`regid`='".$regid."',`locid`='".$locid."'
2004-10-16 00:28:17 +00:00
where `id`='".$_SESSION['profile']['id']."'");
echo _("Your details have been updated.");
}
?>