www-thermferm/profiles.php

changeset 253
7b6abc0dd1c6
parent 196
4d7a96c5d1ff
child 274
111b0e9663dc
equal deleted inserted replaced
252:2197976f2bc5 253:7b6abc0dd1c6
183 */ 183 */
184 if ($_POST['key'] == 'Delete') { 184 if ($_POST['key'] == 'Delete') {
185 send_cmd("PROFILE DEL ".$_POST['UUID']); 185 send_cmd("PROFILE DEL ".$_POST['UUID']);
186 } 186 }
187 187
188
189 if ($_POST['key'] == 'Save') { 188 if ($_POST['key'] == 'Save') {
190 $sock = open_socket(); 189 $cmd = array("PROFILE PUT ".$_POST['UUID']);
191 if ($sock != false) { 190 $cmd[] = "NAME,".$_POST['Name'];
192 /* 191 $cmd[] = "INITTEMP,".$_POST['Inittemp'];
193 * Send command and absorb the result. 192 $cmd[] = ".";
194 */ 193 send_array($cmd);
195 socket_write($sock, "PROFILE PUT ".$_POST['UUID'], 4096);
196 usleep(20000);
197 socket_write($sock, "NAME,".$_POST['Name'], 4096);
198 usleep(20000);
199 socket_write($sock, "INITTEMP,".$_POST['Inittemp'], 4096);
200 usleep(20000);
201 socket_write($sock, ".", 4096);
202 while (1) {
203 $line = socket_read($sock, 4096);
204 if ($line === '')
205 break;
206 }
207 socket_close($sock);
208 }
209 } 194 }
210 195
211 unset($_POST['UUID']); 196 unset($_POST['UUID']);
212 unset($_POST['Name']); 197 unset($_POST['Name']);
213 unset($_POST['Inittemp']); 198 unset($_POST['Inittemp']);
234 * 99 = Cancel key 219 * 99 = Cancel key
235 */ 220 */
236 function test_thesteps() { 221 function test_thesteps() {
237 222
238 global $arr; 223 global $arr;
239
240 // print_r($_POST);
241 224
242 for ($i = 1; $i <= 8; $i++) { 225 for ($i = 1; $i <= 8; $i++) {
243 if ((! isset($_POST['steptime'.$i])) || (! isset($_POST['resttime'.$i])) || (! isset($_POST['target'.$i]))) 226 if ((! isset($_POST['steptime'.$i])) || (! isset($_POST['resttime'.$i])) || (! isset($_POST['target'.$i])))
244 return 1; 227 return 1;
245 if ((strlen($_POST['steptime'.$i]) == 0) || (strlen($_POST['resttime'.$i]) == 0) || (strlen($_POST['target'.$i]) == 0)) 228 if ((strlen($_POST['steptime'.$i]) == 0) || (strlen($_POST['resttime'.$i]) == 0) || (strlen($_POST['target'.$i]) == 0))

mercurial