Skip to content
Find file
Fetching contributors…
Cannot retrieve contributors at this time
48 lines (41 sloc) 1.11 KB
function getHistory(){
include 'config/phpconf.php';
$address = $_GET['address'];
$mach_id = intval($_GET['mach_id']);
$dbh = new PDO($dir) or die("cannot open the database");
$sql = 'SELECT * FROM host WHERE mach_id=:mach_id AND addr=:address ORDER BY ontime DESC';
$stmt = $dbh->prepare($sql);
foreach ($stmt->fetchAll() as $row){
$ontime = $row[3];
$offtime = $row[4];
$onstr = date('Y:m:d H:i:s', $ontime);
if($offtime == 0 || $offtime == null || $offtime == "")
$offstr = "";
$offstr = date('Y:m:d H:i:s', $offtime);
echo '<tr>';
echo '<td class="highlight_nohand">'.$onstr.'</td>';
echo '<td class="highlight_nohand">'.$offstr.'</td>';
echo '</tr>';
<table id="history_table" class="tablesorter">
<th>On Time (UTC)</th>
<th>Off Time (UTC)</th>
<?php getHistory(); ?>
<script type="text/javascript">
$(document).ready(function() {
Something went wrong with that request. Please try again.