www-thermferm/units.php

changeset 134
f05601490415
child 140
1b001de37945
equal deleted inserted replaced
133:345307762220 134:f05601490415
1 <?php
2 /*****************************************************************************
3 * Copyright (C) 2014
4 *
5 * Michiel Broek <mbroek at mbse dot eu>
6 *
7 * This file is part of ThermFerm
8 *
9 * This is free software; you can redistribute it and/or modify it
10 * under the terms of the GNU General Public License as published by the
11 * Free Software Foundation; either version 2, or (at your option) any
12 * later version.
13 *
14 * ThermFerm is distributed in the hope that it will be useful, but
15 * WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with ThermFerm; see the file COPYING. If not, write to the Free
21 * Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
22 *****************************************************************************/
23
24 require_once('utilities.php');
25
26
27 $sock = open_socket();
28 if ($sock == false) {
29 echo "";
30 return;
31 }
32
33 socket_write($sock, "LIST", 4096);
34 $answer = "";
35 while (1) {
36 $line = socket_read($sock, 4096);
37 if ($line === '')
38 break;
39 $answer .= $line;
40 }
41 socket_close($sock);
42 $arr = explode("\r\n", $answer);
43
44
45 $outstr = build_header();
46 $outstr .= ' <div id="errors">'.PHP_EOL;
47 $outstr .= ' </div> <!-- errors -->'.PHP_EOL;
48 $outstr .= ' <div id="etable">'.PHP_EOL;
49
50 $outstr .= ' <table class="setup">'.PHP_EOL;
51 $outstr .= ' <tr style="background-color: #FFCC01;"><td class="setup">UUID</td><td class="setup">Name</td><td class="setup">Mode</td></tr>'.PHP_EOL;
52
53 if (startsWith($arr[0], "212")) {
54 $j = 1;
55 while (1) {
56 if (strcmp($arr[$j], ".") == 0)
57 break;
58 $f = explode(",", $arr[$j]);
59 $outstr .= ' <tr class="setup"><td class="setup">'.$f[0].'</td><td class="setup">'.$f[1].'</td><td class="setup">'.$f[2].'</td></tr>'.PHP_EOL;
60 $j++;
61 }
62 }
63
64 $outstr .= ' </table>'.PHP_EOL;
65 $outstr .= ' </div> <!-- etable -->'.PHP_EOL;
66 $outstr .= build_footer();
67
68 echo $outstr;
69

mercurial