12 if(getenv('REMOTE_USER')=='') die('Cannot get auth');
16 $now=date('Y-m-d H:i:s');
17 $fromTime=date('Y-m-d H:i:s', strtotime($now." -3 day"));
21 if(isset($_GET['userId']))$userId=$_GET['userId'];
22 if(isset($_GET['device']))$device=$_GET['device'];
23 if(isset($_GET['fromTime']))$fromTime=$_GET['fromTime'];
24 if(isset($_GET['toTime']))$toTime=$_GET['toTime'];
26 // show html table for query parameters
28 print("<form method=GET action=showlog.php");
29 print("<tr><td>UserId</td><td><input size=30 type=text name=userId value='".$userId."'></td></tr>");
30 print("<tr><td>Device</td><td><input size=30 type=text name=device value='".$device."'></td></tr>");
31 print("<tr><td>FromTime</td><td><input size=30 type=text name=fromTime value='".$fromTime."'></td></tr>");
32 print("<tr><td>ToTime</td><td><input size=30 type=text name=toTime value='".$toTime."'></td></tr>");
33 print("<tr><td></td><td><input type=submit value='send'></td></tr>");
34 print("</table></p>");
36 // connect and access to MySql db
37 $link = mysql_connect('localhost', 'root', '');
38 if (!$link) die('Cannot connet to DB'.mysql_error());
40 $db_selected = mysql_select_db('opengatem', $link);
41 if (!$db_selected) die('Cannot select DB'.mysql_error());
43 mysql_set_charset('utf8');
45 $result = mysql_query('SELECT * FROM sessionview where userId like "'.$userId.'" and device like "'.$device.'" and "'.$fromTime.'"<openTime and openTime<"'.$toTime.'"');
47 if (!$result) die('Fail query'.mysql_error());
50 print("<table border=1>");
53 while ($field = mysql_fetch_field($result)) {
54 print('<td>'.$field->name.'</td>');
60 while ($row = mysql_fetch_row($result)) {
62 for($i=0; $i<$count; $i++){
63 print('<td>'.$row[$i].'</td>');
69 $close_flag = mysql_close($link);