function handleDailyQuery($conn, $row) { $timeGap = strtotime($row["endTime"]) - strtotime(date("Y-m-d H:i:s")) < 0; if ($timeGap) { echo $row["toRepeat"] . " <br>"; if ($row["toRepeat"] == "Daily") { $newTimeStart = date('Y-m-d H:i', strtotime('+' . 1 . ' days', strtotime($row["startTime"]))); $newTimeEnd = date('Y-m-d H:i', strtotime('+' . 1 . ' days', strtotime($row["endTime"]))); $sql = "UPDATE " . NAME_DB_TOUSE . " SET startTime='" . $newTimeStart . "',endTime='" . $newTimeEnd . "' WHERE id=" . $row["id"]; if ($conn->query($sql) === TRUE) { return TRUE; } else { EraseQuery($conn, $row["id"]); return FALSE; } } else { EraseQuery($conn, $row["id"]); return FALSE; } } return TRUE; }
$conn = startConnection(); if (checkVariables() != 34566543) { die('Variables Problem'); } $sVar = new StdClass(); $sVar->Command = $_POST['Command']; if ($sVar->Command != NULL) { if (sha1($_POST['psswd']) == PWD_SHA) { if ($sVar->Command == 'Add') { $sVar = getVariablesAdd($sVar); if (!addQuerySelect($conn, $sVar)) { die("add Problem"); } } elseif ($sVar->Command == 'Erase') { $sVar = getVariablesErase($sVar); if (!EraseQuery($conn, $sVar->id)) { die("Erase Problem"); } } elseif ($sVar->Command == 'Update') { $sVar = getVariablesUpdate($sVar); $ipAddFile = fopen(IPtextName, "r") or die("Unable to open file!"); $ipAdd = fread($ipAddFile, filesize(IPtextName)); fclose($ipAddFile); $baseURL = 'http://' . $ipAdd; $fullURL = $baseURL; switch ($sVar->action) { case "Update From List": $fullURL = $baseURL . '/gpio/u'; break; case "Get Current Status": $fullURL = $baseURL . '/gpio/s';