";
?>
Electricity Log
= 0; $i -= 2) {
if ($electricity == True) {
echo "Electricity on from ";
$electricity = False;
} else {
echo "Electricity off from ";
$electricity = True;
}
$date = $jsonData[$i];
$date2 = $jsonData[$i - 1];
echo "$date[0] $date[1], $date[2] at $date[3]:$date[4]";
echo " to ";
echo "$date2[0] $date2[1], $date2[2] at $date2[3]:$date2[4]
";
}
// Resets the outage reporter when requested by deleting all of data.json and using the last entry and putting that in twice into the json
if ($PRIVILEGE["deleteElectricity"]) {
if (array_key_exists("reset", $_POST)) {
writeLog(4, "Electricity log cleared by $USERNAME or $address");
echo "Resetting Outage Reporter";
$jsonInfo = file_get_contents("data.json");
$jsonFile = fopen("data.json", "w");
$jsonData = json_decode($jsonInfo, true);
$important = $jsonData[count($jsonData) - 1];
$important = json_encode([$important, $important]);
fwrite($jsonFile, $important);
fclose($jsonFile);
header("Refresh:1; url=/electricity.php", true);
} else {
echo '';
}
}
?>