Updated addjob
This commit is contained in:
parent
925c9fd6f3
commit
2d336d6a12
15
addjob.php
15
addjob.php
|
@ -64,9 +64,17 @@ elseif ($_SERVER["REQUEST_METHOD"] == "POST") {
|
|||
$name = $_POST['name'];
|
||||
$delay = $_POST['delay'];
|
||||
$expected = $_POST['expected'];
|
||||
$eternal = (isset($_POST['eternal']) && $_POST['eternal'] == true) ? true : false;
|
||||
$nextrunObj = DateTime::createFromFormat("d/m/Y H:i:s", $_POST['nextrun']);
|
||||
$nextrun = $nextrunObj->getTimestamp();
|
||||
|
||||
|
||||
if (!$eternal) {
|
||||
$lastrunObj = DateTime::createFromFormat("d/m/Y H:i:s", $_POST['lastrun']);
|
||||
$lastrun = $nextrunObj->getTimestamp();
|
||||
} else {
|
||||
$lastrun = -1;
|
||||
}
|
||||
|
||||
if(!is_numeric($delay)) {
|
||||
header("location:addjob.php?error=invaliddelay");
|
||||
exit;
|
||||
|
@ -75,7 +83,10 @@ elseif ($_SERVER["REQUEST_METHOD"] == "POST") {
|
|||
header("location:addjob.php?error=invalidnextrun");
|
||||
exit;
|
||||
}
|
||||
|
||||
if(!is_numeric($lastrun)) {
|
||||
header("location:addjob.php?error=invalidlastrun");
|
||||
exit;
|
||||
}
|
||||
|
||||
$stmt = $db->prepare("INSERT INTO jobs(user, name, url, host, delay, nextrun, expected) VALUES(?, ?, ?, ?, ?, ?, ?)");
|
||||
$stmt->execute(array($_SESSION["userID"], $name, $url, $host, $delay, $nextrun, $expected));
|
||||
|
|
|
@ -56,7 +56,19 @@
|
|||
</span>
|
||||
<input type="text" class="form-control" name="nextrun">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="lastrun">Last run</label>
|
||||
<div class="input-group date" id="lastrunselector">
|
||||
<span class="input-group-addon">
|
||||
<span><label id="eternal"><input type="checkbox" name="eternal" value="true">Eternal</label></span>
|
||||
</span>
|
||||
<span class="input-group-addon">
|
||||
<span class="glyphicon glyphicon-calendar"></span>
|
||||
</span>
|
||||
<input type="text" class="form-control" name="lastrun">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="expected">Expected exit code</label>
|
||||
<input type="text" name="expected" class="form-control" id="host" placeholder="200">
|
||||
|
|
Loading…
Reference in New Issue