www-thermferm/getprofiles.php

changeset 132
8bd209d1c020
parent 131
528dc0bb81ab
equal deleted inserted replaced
131:528dc0bb81ab 132:8bd209d1c020
22 *****************************************************************************/ 22 *****************************************************************************/
23 23
24 require_once('utilities.php'); 24 require_once('utilities.php');
25 25
26 26
27
28 if (isset($_GET['update'])) {
29 /*
30 * Build the update command
31 */
32 $update_cmd = "PROFILE ".$_GET['UUID'].",".$_GET['Name'];
33
34 $sock = open_socket();
35 if ($sock != false) {
36 /*
37 * Send command and absorb the result.
38 */
39 socket_write($sock, $update_cmd, 4096);
40 while (1) {
41 $line = socket_read($sock, 4096);
42 if ($line === '')
43 break;
44 }
45 socket_close($sock);
46 }
47 }
48
49
50
51 /*
52 * Get current profiles
53 */
27 $sock = open_socket(); 54 $sock = open_socket();
28 if ($sock == false) { 55 if ($sock == false) {
29 echo ""; 56 echo "";
30 return; 57 return;
31 } 58 }
38 break; 65 break;
39 $answer .= $line; 66 $answer .= $line;
40 } 67 }
41 socket_close($sock); 68 socket_close($sock);
42 $arr = explode("\r\n", $answer); 69 $arr = explode("\r\n", $answer);
70 $row = '[';
43 71
44
45 $row = '[';
46 72
47 /* We don't use json_encode because it doesn't work for our purpose */ 73 /* We don't use json_encode because it doesn't work for our purpose */
48 if (startsWith($arr[0], "212")) { 74 if (startsWith($arr[0], "212")) {
49 $j = 1; 75 $j = 1;
50 while (1) { 76 while (1) {

mercurial