diff --git a/js/site.js b/js/site.js index 019e12a..ee82587 100644 --- a/js/site.js +++ b/js/site.js @@ -47,7 +47,7 @@ $(document).ready(function() { }); }); $("body").on("focusout", "input[name=url]", function() { - if($("input[name=url]").val().indexOf("reboot") !== -1) { + if($("input[name=url]").val().startsWith("reboot") !== -1) { $("label[for=expected]").html("Capture services after reboot? (1: yes; 0: no)"); $("input[name=expected]").attr("placeholder", "1"); } diff --git a/runnow.php b/runnow.php index 33687d2..65cfbe5 100644 --- a/runnow.php +++ b/runnow.php @@ -49,7 +49,7 @@ if (filter_var($jobnameResult[0]["url"], FILTER_VALIDATE_URL)) { $timestamp = time(); } else { - if(!stristr($jobnameResult[0]["url"],"reboot")) { + if(strpos($jobnameResult[0]["url"],"reboot") !== 0) { $body = ''; $statuscode = 0; $url = "ssh " . $jobnameResult[0]['host'] . " '" . $jobnameResult[0]['url'] . "' 2>&1"; diff --git a/runs.php b/runs.php index d1e7f4f..b0678d2 100644 --- a/runs.php +++ b/runs.php @@ -34,7 +34,7 @@ if ($jobnameResult[0]["user"] != $_SESSION["userID"]) { exit; } $jobName = $jobnameResult[0]['name']; -$rebootjob = stristr($jobnameResult[0]["url"],"reboot") ? true : false; +$rebootjob = strpos($jobnameResult[0]["url"],"reboot") === 0 ? true : false; $runsForJobQry = "SELECT runs.*, jobs.jobID FROM runs, jobs WHERE runs.job = jobs.jobID AND runs.job = ?"; $allruns = true; diff --git a/webcron.php b/webcron.php index df85b2d..102953f 100644 --- a/webcron.php +++ b/webcron.php @@ -81,7 +81,7 @@ foreach ($results as $result) { $body = $res->getBody(); } else { - if(!stristr($result["url"],"reboot")) { + if(strpos($result["url"],"reboot") !== 0) { $body = ''; $statuscode = 0; $url = "ssh " . $result['host'] . " '" . $result['url'] . "' 2>&1";