53 unset($_POST['UUID']); |
53 unset($_POST['UUID']); |
54 unset($_POST['mode']); |
54 unset($_POST['mode']); |
55 } |
55 } |
56 |
56 |
57 |
57 |
|
58 if (isset($_POST['HeaterState']) && isset($_POST['UUID'])) { |
|
59 $sock = open_socket(); |
|
60 if ($sock != false) { |
|
61 socket_write($sock, 'UNIT PUT '.$_POST['UUID'], 4096); |
|
62 usleep(20000); |
|
63 socket_write($sock, 'HEATER_STATE,'.$_POST['HeaterState'], 4096); |
|
64 usleep(20000); |
|
65 socket_write($sock, '.', 4096); |
|
66 /* Absorb response */ |
|
67 while (1) { |
|
68 $line = socket_read($sock, 4096); |
|
69 if ($line === '') |
|
70 break; |
|
71 } |
|
72 socket_close($sock); |
|
73 } |
|
74 unset($_POST['UUID']); |
|
75 unset($_POST['HeaterState']); |
|
76 } |
|
77 |
|
78 |
|
79 if (isset($_POST['CoolerState']) && isset($_POST['UUID'])) { |
|
80 $sock = open_socket(); |
|
81 if ($sock != false) { |
|
82 socket_write($sock, 'UNIT PUT '.$_POST['UUID'], 4096); |
|
83 usleep(20000); |
|
84 socket_write($sock, 'COOLER_STATE,'.$_POST['CoolerState'], 4096); |
|
85 usleep(20000); |
|
86 socket_write($sock, '.', 4096); |
|
87 /* Absorb response */ |
|
88 while (1) { |
|
89 $line = socket_read($sock, 4096); |
|
90 if ($line === '') |
|
91 break; |
|
92 } |
|
93 socket_close($sock); |
|
94 } |
|
95 unset($_POST['UUID']); |
|
96 unset($_POST['CoolerState']); |
|
97 } |
|
98 |
|
99 |
|
100 if (isset($_POST['FanState']) && isset($_POST['UUID'])) { |
|
101 $sock = open_socket(); |
|
102 if ($sock != false) { |
|
103 socket_write($sock, 'UNIT PUT '.$_POST['UUID'], 4096); |
|
104 usleep(20000); |
|
105 socket_write($sock, 'FAN_STATE,'.$_POST['FanState'], 4096); |
|
106 usleep(20000); |
|
107 socket_write($sock, '.', 4096); |
|
108 /* Absorb response */ |
|
109 while (1) { |
|
110 $line = socket_read($sock, 4096); |
|
111 if ($line === '') |
|
112 break; |
|
113 } |
|
114 socket_close($sock); |
|
115 } |
|
116 unset($_POST['UUID']); |
|
117 unset($_POST['FanState']); |
|
118 } |
|
119 |
|
120 |
58 |
121 |
59 $outstr = '<!DOCTYPE html>'.PHP_EOL; |
122 $outstr = '<!DOCTYPE html>'.PHP_EOL; |
60 $outstr .= '<html>'.PHP_EOL; |
123 $outstr .= '<html>'.PHP_EOL; |
61 $outstr .= ' <head>'.PHP_EOL; |
124 $outstr .= ' <head>'.PHP_EOL; |
62 $outstr .= ' <meta http-equiv="content-type" content="text/html; charset=utf-8" />'.PHP_EOL; |
125 $outstr .= ' <meta http-equiv="content-type" content="text/html; charset=utf-8" />'.PHP_EOL; |