cacert-webdb/pages/account/53.php

110 lines
3.9 KiB
PHP
Raw Normal View History

<? /*
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.
*/ ?>
<?
2005-12-04 21:04:05 +00:00
$town = mysql_escape_string(stripslashes($_REQUEST['town']));
2006-03-05 11:18:16 +00:00
$regid = intval($_REQUEST['regid']);
2006-04-17 12:02:09 +00:00
$ccid = intval($_REQUEST['ccid']);
2005-12-04 21:04:05 +00:00
$start = intval($_REQUEST['start']);
$limit = 25;
echo "<div id='listshow'><ul class='top'>\n<li>";
echo "<a href='account.php?id=53'>"._("Home")."</a>\n";
$display = "";
2006-03-05 11:18:16 +00:00
if($regid > 0)
{
2006-03-05 11:18:16 +00:00
$reg = mysql_fetch_assoc(mysql_query("select * from `regions` where `id`='$regid'"));
$display = "<ul class='top'>\n<li>\n".
2006-03-05 11:18:16 +00:00
"<a href='account.php?id=53&regid=$regid'>$reg[name]</a> - <a href='account.php?action=add&id=54&regid=$regid'>Add</a>\n".
$display;
2005-12-04 21:04:05 +00:00
$_REQUEST['ccid'] = $reg['ccid'];
}
2006-03-05 11:18:16 +00:00
if($ccid > 0)
{
2006-03-05 11:18:16 +00:00
$cnt = mysql_fetch_assoc(mysql_query("select * from `countries` where `id`='$ccid'"));
$display = "<ul class='top'>\n<li>\n".
2006-03-05 11:18:16 +00:00
"<a href='account.php?id=53&ccid=$ccid'>$cnt[name]</a> - <a href='account.php?action=add&id=54&ccid=$ccid'>Add</a>\n".
$display;
}
if($display)
echo $display;
2006-03-05 11:18:16 +00:00
if($ccid <= 0)
{
echo "<ul>\n";
$query = "select * from `countries` order by `name`";
$res = mysql_query($query);
while($row = mysql_fetch_assoc($res))
echo "<li><a href='account.php?id=53&ccid=$row[id]'>$row[name]</a></li>\n";
echo "</ul>\n</li>\n</ul></div>\n<br>\n";
2006-03-05 11:18:16 +00:00
} elseif($regid <= 0) {
echo "<ul>\n";
2006-03-05 11:18:16 +00:00
$query = "select * from `regions` where `ccid`='$ccid' order by `name`";
$res = mysql_query($query);
while($row = mysql_fetch_assoc($res))
2005-12-04 21:04:05 +00:00
{
echo "<li>( <a href='account.php?action=edit&id=54&regid=$row[id]'>edit</a> |";
echo " <a href='account.php?action=delete&id=53&regid=$row[id]'";
echo " onclick=\"return confirm('Are you sure you want to delete this region and all connected locations?');\">delete</a> )";
echo " <a href='account.php?id=53&regid=$row[id]'>$row[name]</a></li>\n";
}
echo "</ul>\n</li>\n</ul>\n</li>\n</ul></div>\n<br>\n";
2005-12-04 21:04:05 +00:00
} elseif(intval($_REQUEST['locid']) <= 0) {
echo "<ul>\n";
if($town != "")
{
2006-03-05 11:18:16 +00:00
$query = "select * from `locations` where `regid`='$regid' and `name` < '$town'";
$start = mysql_num_rows(mysql_query($query));
}
2006-03-05 11:18:16 +00:00
$query = "select * from `locations` where `regid`='$regid' order by `name` limit $start, $limit";
$res = mysql_query($query);
while($row = mysql_fetch_assoc($res))
2005-12-04 21:04:05 +00:00
{
echo "<li>( <a href='account.php?action=move&id=54&locid=$row[id]'>move</a> |";
2006-02-03 18:45:23 +00:00
echo " <a href='account.php?action=aliases&id=54&locid=$row[id]'>aliases</a> |";
2005-12-04 21:04:05 +00:00
echo " <a href='account.php?action=edit&id=54&locid=$row[id]'>edit</a> |";
echo " <a href='account.php?action=delete&id=53&locid=$row[id]'";
echo " onclick=\"return confirm('Are you sure you want to delete this location?');\">delete</a> ) $row[name]</li>\n";
}
echo "</ul>\n</li>\n</ul>\n</li>\n</ul></div>\n<br>\n";
2006-03-05 11:18:16 +00:00
$rc = mysql_num_rows(mysql_query("select * from `locations` where `regid`='$regid'"));
if($start > 0)
{
$prev = $start - $limit;
if($prev < 0)
$prev = 0;
2006-03-05 11:18:16 +00:00
$st = "[ <a href='account.php?id=53&regid=$regid'><< Start</a> ] ";
$prev = "[ <a href='account.php?id=53&regid=$regid&start=$prev'>< Previous $limit</a> ] ";
}
if($start < $rc - $limit)
{
$next = $start + $limit;
$last = $rc - $limit;
2006-03-05 11:18:16 +00:00
$next = "[ <a href='account.php?id=53&regid=$regid&start=$next'>Next $limit ></a> ] ";
$end = "[ <a href='account.php?id=53&regid=$regid&start=$last'>End >></a> ]";
}
echo "<div id='search1'>$st</div><div id='search3'>$end</div>\n";
echo "<div id='search2'>$prev</div><div id='search4'>$next</div>\n";
2005-12-04 21:04:05 +00:00
}
?>