Added function send_array_check

Wed, 20 Aug 2014 13:51:44 +0200

author
Michiel Broek <mbroek@mbse.eu>
date
Wed, 20 Aug 2014 13:51:44 +0200
changeset 255
fb930d1db5a6
parent 254
b29f80afaeac
child 256
8c52b09bdecc

Added function send_array_check

www-thermferm/utilities.php file | annotate | diff | comparison | revisions
--- a/www-thermferm/utilities.php	Wed Aug 20 13:10:10 2014 +0200
+++ b/www-thermferm/utilities.php	Wed Aug 20 13:51:44 2014 +0200
@@ -113,6 +113,23 @@
 
 
 
+/*
+ * @param array $command to send to the server.
+ * Return: 0 = Ok.
+ *         1 = Server responden with an error.
+ */
+function send_array_check($command)
+{
+    $answer = send_array($command);
+
+    if (strlen($answer) && (($answer[0] == '1') || ($answer[0] == '2')))
+	return 0;
+
+    return 1;
+}
+
+
+
 function startsWith($haystack, $needle)
 {
     return !strncmp($haystack, $needle, strlen($needle));

mercurial