File: /var/www/content-sp/work-sp/user_session_history.php
<?php
include_once('header.php');
// error_reporting(0);
// error_reporting(E_ALL);
// ini_set('display_errors', 'On');
$curDate = date('Y-m-d H:i:s');
echo $date = date('Y-m-d');
$text = "On Date : " . $date;
$subQuery = " and date(datetime)='$date'";
if (isset($_REQUEST['search_data'])) {
$date = $_REQUEST['es_ondate'];
$subQuery = '';
if ($date != '') {
$date = date('Y-m-d', strtotime($date));
$subQuery .= " and date(datetime)='$date'";
}
if ($es_fromdate != '' && $es_todate != '') {
$fromDate = date('Y-m-d', strtotime($es_fromdate));
$toDate = date('Y-m-d', strtotime($es_todate));
$subQuery .= " and (date(datetime) BETWEEN '$fromDate' AND '$toDate')";
}
$_SESSION['report_subQuery'] = $subQuery;
}
$sesQuery = "SELECT session_id, count(id) as sescnt,user_name, datetime from `csp_user_session_history` where session_id!='' $subQuery group by session_id,user_id order by datetime";
$sesData = $conn->query($sesQuery);
?>
<link rel="stylesheet" type="text/css" href="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery-ui.css" />
<script src="assets/plugins/jquery/jquery-2.1.3.min.js"></script>
<script src="assets/plugins/jquery-ui/jquery-ui.min.js"></script>
<script type="text/javascript">
var jq = jQuery.noConflict();
jq(document).ready(function() {
jq("#date").datepicker({
changeMonth: true,
changeYear: true,
dateFormat: 'yy-mm-dd'
});
jq("#todate").datepicker({
changeMonth: true,
changeYear: true,
dateFormat: 'dd-mm-yy'
});
jq("#fromdate").datepicker({
changeMonth: true,
changeYear: true,
dateFormat: 'dd-mm-yy'
});
jq(".dets").click(function(event) {
//alert("hello");
var datee = jQuery("#date").val();
jq('#loadingImg').show();
var sesid = this.id;
var loadUrl = "user_session_history_data.php?sesid=" + sesid +"&date="+ datee;
var jqxhr = jQuery.get(loadUrl);
jqxhr.success(function(data) {
//alert(data);
jQuery("#sesdata_table").html(data);
jq('#loadingImg').hide();
jq('html,body').animate({
scrollTop: jq("#sesdata_table").offset().top
},
1000);
});
});
});
</script>
<div class="page-inner">
<div class="row">
<div class="col-md-6">
<div class="page-title">
<h3>
<Param>User Session</Param>
</h3>
</div>
</div>
<div class="col-md-6">
<form class="form-horizontal" method="post" onSubmit="return validateForm();">
<div class="form-group">
<label for="date" class="col-sm-2">On Date</label>
<div class="col-sm-6">
<input type="text" class="form-control" name="es_ondate" id="date" placeholder="On Date" value="<?php echo @$date; ?>" autocomplete="off">
</div>
<div class="col-sm-4">
<input type="submit" class="btn btn-primary" value="Search" name="search_data">
</div>
</div>
</form>
</div>
</div>
<div id="main-wrapper">
Description Order - ["REQUEST_URI", "SCRIPT_NAME", "QUERY_STRING", "SCRIPT_FILENAME", "SERVER_PORT", HTTP_REFERER, "HTTP_USER_AGENT", "REQUEST_TIME", "IP_ADDRESS"]
<div class="row">
<div class="col-md-5">
<div class="panel panel-info">
<div class="panel-heading clearfix">
<h4 class="panel-title" style="width: 100%;">
<span style="width:90%; float:left;">
Content Server Session [ <?php echo $text; ?> ]
</span>
</h4>
</div>
<div class="panel-body" style="padding:0;">
<div class="table-responsive">
<table id="online_txn" class="display table" style="width: 100%;">
<thead>
<tr>
<th>S.No</th>
<th>SessionId</th>
<th>Count</th>
<th>FirstVisit</th>
<th>Details</th>
</tr>
<?php
$i = 1;
while ($sdt = $sesData->fetch_assoc()) {
//foreach ($sesData as $sdt) {
?>
<tr>
<td><?php echo $i; ?></td>
<td><?php echo $sdt['session_id'].'-'.$sdt['user_name']; ?></td>
<td><?php echo $sdt['sescnt']; ?></td>
<td><?php echo $sdt['datetime']; ?></td>
<td><i class="fa fa-info-circle infos dets" id="<?php echo $sdt['session_id']; ?>"></i></td>
</tr>
<?php $i++;
} ?>
</thead>
</table>
</div>
</div>
</div>
</div>
<div class="col-md-7">
<img id="loadingImg" style="margin-left:35%; width:25px; display:none;" src="/work-sp/assets/images/reload.GIF" />
<div id="sesdata_table" class="test_table"></div>
</div>
<div class="page-footer">
<p class="no-s">Graposs Connect ©</p>
</div>
</div>
<style>
.form-horizontal {
padding: 20px 0px 1px 15px;
background: #e9edf2;
border-bottom: 1px solid #dee2e8;
margin: 0px 0px 0px 0px;
}
.dets {
cursor: pointer;
font-size: 20px;
}
.table {
font-size: 13px;
}
</style>
<?php
include_once('footer.php');
?>