-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
172 lines (154 loc) · 6.17 KB
/
index.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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
<html>
<head>
<meta name="viewport" content="width=device-width" />
<title>Wecker by Max</title>
<style>
table {
font-family: arial, sans-serif;
border-collapse: collapse;
width: 100%;
}
td, th {
border: 1px solid #dddddd;
text-align: left;
padding: 8px;
}
tr:nth-child(even) {
background-color: #dddddd;
}
</style>
</head>
<body>
<?php
include 'sqlparam.php';
// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
// Monday Query
$result = $conn->query("SELECT * FROM Wecker.Settings WHERE day='monday'");
$resmon = $result->fetch_assoc();
// Tuesday Query
$result = $conn->query("SELECT * FROM Wecker.Settings WHERE day='tuesday'");
$restue = $result->fetch_assoc();
// Wednesday Query
$result = $conn->query("SELECT * FROM Wecker.Settings WHERE day='wednesday'");
$reswed = $result->fetch_assoc();
// Thursday Query
$result = $conn->query("SELECT * FROM Wecker.Settings WHERE day='thursday'");
$resthu = $result->fetch_assoc();
// Friday Query
$result = $conn->query("SELECT * FROM Wecker.Settings WHERE day='friday'");
$resfri = $result->fetch_assoc();
// Saturday Query
$result = $conn->query("SELECT * FROM Wecker.Settings WHERE day='saturday'");
$ressat = $result->fetch_assoc();
// Sunday Query
$result = $conn->query("SELECT * FROM Wecker.Settings WHERE day='sunday'");
$ressun = $result->fetch_assoc();
?>
<form action="submitform.php" method="post">
<table>
<tr>
<th>Day</th>
<th>Enable</th>
<th>Time</th>
</tr>
<tr>
<td> Monday </td>
<?php
if ($resmon["enable"]) {
echo "<td> <input type='checkbox' name='enablemon' value='Yes' checked=checked /> </td> \r\n";
} else {
echo "<td> <input type='checkbox' name='enablemon' value='Yes' /> </td> \r\n";
}
?>
<?php
echo "<td> <input type='time' name='monday_time' value='", substr($resmon['time'],0,5), "'/> </td> \r\n";
?>
</tr>
<tr>
<td> Thuesday </td>
<?php
if ($restue["enable"]) {
echo "<td> <input type='checkbox' name='enabletue' value='Yes' checked=checked /> </td> \r\n";
} else {
echo "<td> <input type='checkbox' name='enabletue' value='Yes' /> </td> \r\n";
}
?>
<?php
echo "<td> <input type='time' name='tuesday_time' value='", substr($restue['time'],0,5), "'/> </td> \r\n";
?>
</tr>
<tr>
<td> Wednesday </td>
<?php
if ($reswed["enable"]) {
echo "<td> <input type='checkbox' name='enablewed' value='Yes' checked=checked /> </td> \r\n";
} else {
echo "<td> <input type='checkbox' name='enablewed' value='Yes' /> </td> \r\n";
}
?>
<?php
echo "<td> <input type='time' name='wednesday_time' value='", substr($reswed['time'],0,5), "'/> </td> \r\n";
?>
</tr>
<tr>
<td> Thursday </td>
<?php
if ($resthu["enable"]) {
echo "<td> <input type='checkbox' name='enablethu' value='Yes' checked=checked /> </td> \r\n";
} else {
echo "<td> <input type='checkbox' name='enablethu' value='Yes' /> </td> \r\n";
}
?>
<?php
echo "<td> <input type='time' name='thursday_time' value='", substr($resthu['time'],0,5), "'/> </td> \r\n";
?>
</tr>
<tr>
<td> Friday </td>
<?php
if ($resfri["enable"]) {
echo "<td> <input type='checkbox' name='enablefri' value='Yes' checked=checked /> </td> \r\n";
} else {
echo "<td> <input type='checkbox' name='enablefri' value='Yes' /> </td> \r\n";
}
?>
<?php
echo "<td> <input type='time' name='friday_time' value='", substr($resfri['time'],0,5), "'/> </td> \r\n";
?>
</tr>
<tr>
<td> Saturday </td>
<?php
if ($ressat["enable"]) {
echo "<td> <input type='checkbox' name='enablesat' value='Yes' checked=checked /> </td> \r\n";
} else {
echo "<td> <input type='checkbox' name='enablesat' value='Yes' /> </td> \r\n";
}
?>
<?php
echo "<td> <input type='time' name='saturday_time' value='", substr($ressat['time'],0,5), "'/> </td> \r\n";
?>
</tr>
<tr>
<td> Sunday </td>
<?php
if ($ressun["enable"]) {
echo "<td> <input type='checkbox' name='enablesun' value='Yes' checked=checked /> </td> \r\n";
} else {
echo "<td> <input type='checkbox' name='enablesun' value='Yes' /> </td> \r\n";
}
?>
<?php
echo "<td> <input type='time' name='sunday_time' value='", substr($ressun['time'],0,5), "'/> </td> \r\n";
?>
</tr>
</table>
<input type="submit" name="submitform" value="Submit" />
</form>
</body>
</html>