Add target for devices/boards to report their status

This commit is contained in:
Junior 2025-03-10 16:38:09 -04:00
parent 2fba4db0af
commit a756b10d18

27
boardstatus.php Normal file
View File

@ -0,0 +1,27 @@
<?php
require 'header.php';
$ipaddress = $_SERVER['REMOTE_ADDR'];
$mac = "";
$board = "";
$service = "";
if ( isset($_REQUEST['mac']) ) $mac = $_REQUEST['mac'];
if ( $mac == "" ) exit();
if ( isset($_REQUEST['board']) ) $board = $_REQUEST['board'];
if ( isset($_REQUEST['service']) ) $service = $_REQUEST['service'];
$query = "INSERT INTO devices (mac, ipaddress, board, service, lastupdate) ";
$query .= "VALUES(:mac, :ipaddress, :board, :service, NOW()) ";
$query .= "ON DUPLICATE KEY UPDATE ";
$query .= "ipaddress=:ipaddress, board=:board, service=:service, lastupdate=NOW()";
$sth = $globaldbh->prepare($query);
$sth->bindValue(":mac", $mac, PDO::PARAM_STR);
$sth->bindValue(":ipaddress", $ipaddress, PDO::PARAM_STR);
$sth->bindValue(":board", $board, PDO::PARAM_STR);
$sth->bindValue(":service", $service, PDO::PARAM_STR);
$sth->execute();
exit();