Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

48 lines (41 sloc) 1.134 kB
<?php
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);
$stmt->execute(array(':mach_id'=>$mach_id,
':address'=>$address));
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 = "";
else
$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">
<thead>
<tr>
<th>On Time (UTC)</th>
<th>Off Time (UTC)</th>
</tr>
</thead>
<tbody>
<?php getHistory(); ?>
</tbody>
</table>
<script type="text/javascript">
$(document).ready(function() {
$("#history_table").tablesorter();
});
</script>
Jump to Line
Something went wrong with that request. Please try again.