| Current Path : /var/www/html/mmishra/ilight/ |
| Current File : /var/www/html/mmishra/ilight/websessions.inc |
<h3 align='left'>Login Sessions</h3>
<center>
<?php
$dated = $_REQUEST["dated"];
if (!$dated) $dated = date("Y-m-d");
$dated1 = date('Y-m-d', strtotime($dated .' -1 day'));
$dated2 = date('Y-m-d', strtotime($dated .' +1 day'));
echo "<a href='?pg=$pg&dated=$dated1'><<</a> <font size='+1' color='red'>[ $dated ]</font> ".($dated != date("Y-m-d") ? "<a href='?pg=$pg&dated=$dated2'>>></a>" : '');
if ($role == 'admin')
$query = "select userid user,sessionid session,logintime login,logouttime logout,duration from websessions where logintime like '$dated%' order by login desc";
else
$query = "select userid user,sessionid session,logintime login,logouttime logout,duration from websessions where userid='$user' and logintime like '$dated%' order by login desc";
$rs = mysql_query($query);
if ($rs) {
$colHeads = mysql_num_fields($rs);
echo "<table border='1' width='90%'>\n<tr><th>Sr</th>";
for ($i=0; $i < $colHeads; $i++) { // Header
$fld = ucwords(str_replace("_"," ",mysql_field_name($rs, $i)));
echo "<th>$fld</th>";
}
echo "</tr>\n";
$j = $pgno;
while ($row = mysql_fetch_row($rs)) { //data
$j++;
echo "<tr><td>$j</td><td>".implode($row,"</td><td>")."</td></tr>\n";
}
echo "</table>\n";
} else {
echo "Sorry";
}
?>
</center>