-
Notifications
You must be signed in to change notification settings - Fork 0
/
submit.php
40 lines (34 loc) · 1.39 KB
/
submit.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
<?php
include 'config.php';
date_default_timezone_set($timezone);
include 'app/device.php';
include 'app/scheduler.php';
$device = new Device($ipaddress, $port, $simulated, $amount_per_min, $num_zones);
$scheduler = new Scheduler();
if ($_POST['start']) {
$scheduler->setSetting('single_duration',$_POST['single_duration']);
$device->runCycle($_POST['single_duration']);
}
elseif ($_POST['stop']) {
$device->stopCycle();
}
elseif ($_POST['save']) {
$scheduler->setSetting('duration',$_POST['duration']);
$scheduler->setSetting('time', str_replace(":", "", $_POST['time']));
$scheduler->setSetting('sunday',$_POST['sunday']);
$scheduler->setSetting('monday',$_POST['monday']);
$scheduler->setSetting('tuesday',$_POST['tuesday']);
$scheduler->setSetting('wednesday',$_POST['wednesday']);
$scheduler->setSetting('thursday',$_POST['thursday']);
$scheduler->setSetting('friday',$_POST['friday']);
$scheduler->setSetting('saturday',$_POST['saturday']);
$scheduler->setSetting('past_rain',$_POST['past_rain']);
$scheduler->setSetting('past_max_amount',$_POST['past_max_amount']);
$scheduler->setSetting('past_num_days',$_POST['past_num_days']);
$scheduler->setSetting('present_rain',$_POST['present_rain']);
$scheduler->setSetting('future_rain',$_POST['future_rain']);
$scheduler->setSetting('future_num_days',$_POST['future_num_days']);
}
header ('HTTP/1.1 301 Moved Permanently');
header("Location: ./")
?>