Ok, this problem seems to evade me.
When I run this code, it works great, until the render1 variable equals 1 and the render2 variable equals 2, or vice versa.
I am lost as to what could be causing the problem, as any other combination of numbers works fine.
Thanks for helping me out. :)
<?php
$status_codes = array(1, 2, 3);
$render1 = 0;
$render2 = 0;
$file = file_get_contents("/system/status"); //Get status file
$output = json_decode($file); //Decode it into variables
if ($output->render1 & $output->render2) { //If variable is available, decode. Otherwise, give up
$render1 = $output->render1;
$render2 = $output->render2;
}
if (in_array($render1, $status_codes) || in_array($render2, $status_codes)) { //If variables are legit, contiune
if ($render1 == 1) {
echo "Render 1 is up and running" . "<br>";
}
if ($render1 == 2) {
echo "Render 1 is offline" . "<br>";
}
if ($render1 == 3) {
echo "Render 1 is offline for scheduled maintinance" . "<br>";
}
if ($render2 == 1) {
echo "Render 2 is up and running";
}
if ($render2 == 2) {
echo "Render 2 is offline";
}
if ($render2 == 3) {
echo "Render 2 is offline for scheduled maintinance";
}
}
else {
echo "Status file is corrupt or unavailable";
}
?>


Sign In
Create Account

Back to top









