Skip to content
This repository has been archived by the owner on May 9, 2020. It is now read-only.

Commit

Permalink
Made admin/ pages XHTML 1.0 STRICT valid.
Browse files Browse the repository at this point in the history
Moved table generating to adminutils.php.
  • Loading branch information
ward committed Mar 27, 2010
1 parent 0b5cc07 commit 113396c
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 70 deletions.
17 changes: 2 additions & 15 deletions admin/all.inc
@@ -1,18 +1,5 @@
<table>
<tr>
<th>User</th>
<th>IP</th>
<th>Time</th>
</tr>
<?php
$mydb = new DB();
$result = $mydb->getAll();
foreach ($result as $row) {
echo "<tr>\n";
echo "<td><a href='?p=id&q={$row['id']}'>{$row['name']}</a></td>\n";
echo "<td><a href='?p=ip&q={$row['ip']}'>{$row['ip']}</a></td>\n";
echo "<td>{$row['time']}</td>\n";
echo "</tr>\n";
}
?>
</table>
showResultTable($result);
?>
27 changes: 8 additions & 19 deletions admin/id.inc
@@ -1,26 +1,15 @@
<?php $q = getSearch(); ?>
<form method="get">
<input type="hidden" name="p" value="<?php echo getPage(); ?>" />
<input type="text" name="q" value="<?php echo $q; ?>" />
<input type="submit" value="Search ID" />
<form method="get" action="">
<p>
<input type="hidden" name="p" value="<?php echo getPage(); ?>" />
<input type="text" name="q" value="<?php echo $q; ?>" />
<input type="submit" value="Search ID" />
</p>
</form>
<?php
if ($q) {
echo "<table>
<tr>
<th>User</th>
<th>IP</th>
<th>Time</th>
</tr>";
$mydb = new DB();
$result = $mydb->getById($q);
foreach ($result as $row) {
echo "<tr>\n";
echo "<td><a href='?p=id&q={$row['id']}'>{$row['name']}</a></td>\n";
echo "<td><a href='?p=ip&q={$row['ip']}'>{$row['ip']}</a></td>\n";
echo "<td>{$row['time']}</td>\n";
echo "</tr>\n";
}
echo "</table>";
showResultTable($result);
}
?>
?>
25 changes: 7 additions & 18 deletions admin/ip.inc
@@ -1,26 +1,15 @@
<?php $q = getSearch(); ?>
<form method="get">
<input type="hidden" name="p" value="<?php echo getPage(); ?>" />
<input type="text" name="q" value="<?php echo $q; ?>" />
<input type="submit" value="Search IP" />
<form method="get" action="">
<p>
<input type="hidden" name="p" value="<?php echo getPage(); ?>" />
<input type="text" name="q" value="<?php echo $q; ?>" />
<input type="submit" value="Search IP" />
</p>
</form>
<?php
if ($q) {
echo "<table>
<tr>
<th>User</th>
<th>IP</th>
<th>Time</th>
</tr>";
$mydb = new DB();
$result = $mydb->getByIp($q);
foreach ($result as $row) {
echo "<tr>\n";
echo "<td><a href='?p=id&q={$row['id']}'>{$row['name']}</a></td>\n";
echo "<td><a href='?p=ip&q={$row['ip']}'>{$row['ip']}</a></td>\n";
echo "<td>{$row['time']}</td>\n";
echo "</tr>\n";
}
echo "</table>";
showResultTable($result);
}
?>
25 changes: 7 additions & 18 deletions admin/name.inc
@@ -1,26 +1,15 @@
<?php $q = getSearch(); ?>
<form method="get">
<input type="hidden" name="p" value="<?php echo getPage(); ?>" />
<input type="text" name="q" value="<?php echo $q; ?>" />
<input type="submit" value="Search User" />
<form method="get" action="">
<p>
<input type="hidden" name="p" value="<?php echo getPage(); ?>" />
<input type="text" name="q" value="<?php echo $q; ?>" />
<input type="submit" value="Search User" />
</p>
</form>
<?php
if ($q) {
echo "<table>
<tr>
<th>User</th>
<th>IP</th>
<th>Time</th>
</tr>";
$mydb = new DB();
$result = $mydb->getByName($q);
foreach ($result as $row) {
echo "<tr>\n";
echo "<td><a href='?p=id&q={$row['id']}'>{$row['name']}</a></td>\n";
echo "<td><a href='?p=ip&q={$row['ip']}'>{$row['ip']}</a></td>\n";
echo "<td>{$row['time']}</td>\n";
echo "</tr>\n";
}
echo "</table>";
showResultTable($result);
}
?>
17 changes: 17 additions & 0 deletions lib/adminutils.php
Expand Up @@ -22,4 +22,21 @@ function getSort() {
function makeValidId($id) {
return intval($id);
}

function showResultTable($resultArray) {
echo "<table>
<tr>
<th>User</th>
<th>IP</th>
<th>Time</th>
</tr>\n";
foreach ($resultArray as $row) {
echo "<tr>\n";
echo "<td><a href='?p=id&amp;q={$row['id']}'>{$row['name']}</a></td>\n";
echo "<td><a href='?p=ip&amp;q={$row['ip']}'>{$row['ip']}</a></td>\n";
echo "<td>{$row['time']}</td>\n";
echo "</tr>\n";
}
echo "</table>";
}
?>

0 comments on commit 113396c

Please sign in to comment.