<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<TITLE>Viewing / Deleting Records</TITLE>
</HEAD>
<BODY>

<?php
/***************************************************************************
 *			view_user.php                                      *
 *                     	          				           *
 *   File Info:		  View Users                                       *
 *   Copyright:       Copyright 2003 http://www.128concepts.com            *
 *						                           *
 ***************************************************************************/
include ("./your-header.inc");
?>
<center><img src=images/srchfol.gif border=0><font face=verdama size=3 color =navy> Viewing Records from your User's Log</font></center>
<br></center>	

<?php
include("./config.php");
$strvar = getenv("QUERY_STRING");
$pos = strpos($strvar,'=');
if ($pos>=0) 
	$username = substr($strvar,$pos+1);

 if ($_SERVER['REQUEST_METHOD'] == "POST") 
  {
        # escape data and set variables
        $username = addslashes($_POST["username"]);
}
$table = "userlogs";
$conn = @mysql_connect($server,$user,$password)
	or die("Unable to connect to SQL database...");
$rs = @mysql_select_db($database,$conn) 
	or die("Unable to select the database...Please press 'Create Database' to create new database.");
$sql = " SELECT * from $table where username = '$username'";
$rs = mysql_query($sql,$conn)
	or die("Could not execute SQL query!!! Possibly SQL query already been executed.");
$list = "<table border =\"1\" cellpadding =\"2\" align=center>";
$list.="<tr><th><font face=verdana size=2>Session ID</font></th>";
$list.="<th><font face=verdana size=2>Username</font></th>";
$list.="<th><font face=verdana size=2>Time Log In</font></th>";
$list.="<th><font face=verdana size=2>Time Log Out</font></th>";
$list.="<th><font face=verdana size=2>IP Address</font></th>";
$list.="<th><font face=verdana size=2>Referer</font></th>";
$list.="<th><font face=verdana size=2>Browser</font></th>";
$list.="<th><font face=verdana size=2>Date Added</font></th></tr>";

while($row = mysql_fetch_array($rs))
{
	$list.= "<tr><font face=verdana size=2>";
	$list.="<td>".$row["sessid"]."</td>";
	$list.="<td>".$row["username"]."</td>";
	$list.="<td>".$row["timein"]."</td>";
	$list.="<td>".$row["timeout"]."</td>";
	$list.="<td>".$row["ip"]."</td>";
	$list.="<td>".$row["referer"]."</td>";
	$list.="<td>".$row["browser"]."</td>";
	$list.="<td>".$row["date_added"]."</td>";
	$list.="</font></tr>";
}
$list.= "</table>";
echo($list);
?>
<img src=images/line.gif border=0 width=100% height=1><br>
<br>
<center><img src=images/readme.gif border=0><font face=verdana size=2> Notes for all users:</font></center><br>
<p align = justify><font face = "Verdana" size = 2>The above user log table shows all user activities i.e User Log in Time, User Log Out Time, type of browser used etc. N.B The <font color=red>date/time</font> shown is dependent on your server's time.</font></p>
<p><center><a href=shop_showall.php><img src=images/prod-list.gif border=0 height=18></a></center></p>
<?php include("./your-footer.inc");?>
</BODY>
</HTML>