Viewing file: visitation_log.phtml (4.5 KB) -rw-r--r-- Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head> <meta http-equiv="Content-Type" content="text-html; charset=UTF-8" /> <title>AXess - Visitation Log</title> <link rel="stylesheet" href="axess.css?v1" type="text/css" /> <script type="text/javascript" src="js/jquery-1.2.6.pack.js?v1"></script> <script type="text/javascript" src="js/jquery.validate.pack?v1"></script> <script type="text/javascript" src="js/axess.js?v1"></script> </head>
<body id="axessMain"> <?php
$location = 'posts'; require('axess_header.inc');
?>
<div id="axessMessage"> <div class="innerPadding"> <div id="logout"><a href="logout">Logout</a></div> <p> Visitation Log </p> </div> </div> <? echo "<form method=\"post\" action=\"visitation_log\">\n"; echo "<table id=\"visitationInput\" cellpadding=\"2\" cellspacing=\"0\"0>\n"; echo "<tr><td>Exact username to search for in pagehits log:</td><td><input type=text name=name></td></tr>\n"; echo "<tr><td>(part of) username to search for in pagehits log:</td><td><input type=\"text\" name=\"fuzzyname\" /></td></tr>\n"; echo "<tr><td>Exact IP address to search for in pagehits log:</td><td><input type=\"text\" name=\"ipaddr\" /></td></tr>\n"; echo "<tr><td>(part of) IP address to search for in pagehits log (slow and loads server, only use if you really have to, and give as much of the IP address as possible!):</td><td><input type=\"text\" name=\"fuzzyip\" /></td></tr>\n"; echo "<tr><td>Show only entries not older than</td><td><select name=\"timelimit\"><option>1 month</option><option>2 months</option><option>3 months</option><option>6 months</option><option>1 year</option><option>2 years</option><option>3 years</option><option value=\"\">unlimited</option></select></td></tr>\n"; echo "<tr><td colspan=\"2\" align=\"center\"><input type=\"submit\" value=\"Search!\" /></td></tr>\n"; echo "</table>\n"; echo "</form>\n"; function listrecords($query) { $result=pg_exec(pg_connect("dbname=ax"),$query); $rows=pg_numrows($result); echo "<div id=\"queryView\"><b>SQL:</b> ".$query."</div>\n"; echo "<div id=\"queryDetails\"><b>Results:</b> ".$rows." row(s)</div>\n"; echo "<table id=\"visitationTable\" cellpadding=\"0\" cellspacing=\"0\">\n"; for ($row=0;$row<$rows;$row++) { $obj=pg_fetch_array($result,$row); echo "<tr><td class=\"col1\">",$obj[ipaddr],"</td><td class=\"col2\">",$obj[username],"</td><td class=\"col3\">",$obj[date],"</tr>\n"; } echo "</table>\n"; }
/*if ($_SERVER['REQUEST_METHOD']=='GET') { echo "<form method=\"post\" action=\"visitation_log\">"; echo "<table>"; echo "<tr><td>Exact username to search for in pagehits log:</td><td><input type=text name=name></td></tr>"; echo "<tr><td>(part of) username to search for in pagehits log:</td><td><input type=text name=fuzzyname></td></tr>"; echo "<tr><td>Exact IP address to search for in pagehits log:</td><td><input type=text name=ipaddr></td></tr>"; echo "<tr><td>(part of) IP address to search for in pagehits log (slow and loads server, only use if you really have to, and give as much of the IP address as possible!):</td><td><input type=text name=fuzzyip></td></tr>"; echo '<tr><td>Show only entries not older than</td><td><select name=timelimit><option>1 month</option><option>2 months</option><option>3 months</option><option>6 months</option><option>1 year</option><option>2 years</option><option>3 years</option><option value="">unlimited</option></select></td></tr>'; echo "<tr><td colspan=\"2\" align=\"center\"><input type=\"submit\" value=\"Search!\"></td></tr>"; echo "</table>"; echo "</form>"; }*/ if ($_SERVER['REQUEST_METHOD']=='POST') { $query[]= 'select ipaddr, username, date from agents'; if ($_POST[name]) $clauses[]="username='".pg_escape_string($_POST['name'])."'"; if ($_POST[fuzzyname]) $clauses[]="username~*'".pg_escape_string($_POST['fuzzyname'])."'"; if ($_POST[ipaddr]) $clauses[]="ipaddr='".pg_escape_string($_POST['ipaddr'])."'"; if ($_POST[fuzzyip]) $clauses[]="ipaddr~*'".pg_escape_string($_POST['fuzzyip'])."'"; if ($_POST[timelimit]) $clauses[]="date >= ('now'::timestamp - '".pg_escape_string($_POST['timelimit'])."'::interval)";
if ($clauses) { $query[]='where'; $query[]=join(' and ',$clauses); }
$query[]="order by date desc;";
//echo(join(" ",$query)); listrecords(join(" ",$query)); } ?> </body> </html>
|