Viewing file: chatlog.phtml (1.5 KB) -rw-rw-r-- Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php ob_start("ob_gzhandler"); ?> <h1>Name change log search</h1> <?php
pg_connect("dbname=ax");
function do_search_query($begindate, $enddate) { return pg_exec("select * from chatlog where date between '".addslashes($begindate)."'::timestamp and '".addslashes($enddate)."'::timestamp order by date;"); }
function display_dialog() { ?> <form method=get> <table> <tr><td>Beginning date (YYYY-MM-DD HH:MM - you can omit hours and minutes):</td><td><input type=text name=begindate size=40 value="<?= htmlspecialchars($_REQUEST['begindate']); ?>"></td></tr> <tr><td>Ending date (YYYY-MM-DD HH:MM - you can omit hours and minutes):</td><td><input type=text name=enddate size=40 value="<?= htmlspecialchars($_REQUEST['enddate']); ?>"></td></tr> <tr><td></td><td><input type=submit name=search value="Search"></td></tr> </table> </form> <?php }
function tablelist($result) { if (pg_num_rows($result)==0) { echo "<p><b>No such records found.</b></p>"; return; } echo "<table border>"; echo "<tr>"; for ($column=0;$column<pg_num_fields($result);$column++) { echo "<th>".htmlspecialchars(pg_field_name($result,$column))."</th>"; } echo "</tr>"; for ($row=0;$row<pg_num_rows($result);$row++) { $obj=pg_fetch_array($result,$row,PGSQL_NUM); echo "<tr>"; foreach($obj as $value) { echo "<td>".htmlspecialchars($value)."</td>"; } echo "</tr>"; } echo "</table>"; }
display_dialog();
if (isset($_REQUEST['search'])) { tablelist(do_search_query($_REQUEST['begindate'],$_REQUEST['enddate'])); display_dialog(); }
?>
|