27 lines
		
	
	
		
			663 B
		
	
	
	
		
			PHP
		
	
	
	
	
	
			
		
		
	
	
			27 lines
		
	
	
		
			663 B
		
	
	
	
		
			PHP
		
	
	
	
	
	
<?php
 | 
						|
 | 
						|
require "../header.php";
 | 
						|
 | 
						|
$query = "SELECT mac, ipaddress, label, board, firmware, service, lastupdate FROM devices ORDER BY label, lastupdate DESC";
 | 
						|
$sth = $globaldbh->prepare($query);
 | 
						|
$sth->execute();
 | 
						|
 | 
						|
$data = array();
 | 
						|
while ( $row = $sth->fetch(PDO::FETCH_ASSOC) ) {
 | 
						|
   $d = array();
 | 
						|
   $d["mac"] = $row["mac"];
 | 
						|
   $d["ipaddress"] = $row["ipaddress"];
 | 
						|
   $d["label"] = $row["label"];
 | 
						|
   $d["board"] = $row["board"];
 | 
						|
   $d["firmware"] = $row["firmware"];
 | 
						|
   $d["service"] = $row["service"];
 | 
						|
   $d["lastupdate"] = $row["lastupdate"];
 | 
						|
   $data[] = $d;
 | 
						|
}
 | 
						|
 | 
						|
header('Content-Type: application/json');
 | 
						|
echo json_encode($data);
 | 
						|
exit();
 | 
						|
 | 
						|
// vim: et ai sw=3 ts=3:
 |