diff --git a/index.php b/index.php new file mode 100644 index 0000000..9306d85 --- /dev/null +++ b/index.php @@ -0,0 +1,69 @@ + + + raspberry + + += 8) { + $socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP) or die("Could not create socket\n"); + socket_bind($socket, $source) or die("Could not bind to socket\n"); + socket_connect($socket, $target, $port) or die("Could not connect to socket\n"); + socket_write($socket, $output, strlen ($output)) or die("Could not write output\n"); + echo "ACTION: "; + echo "group: ".$nGroup; + echo " switch: ".$nSwitch; + echo " action: ".$nAction; + echo "=> ".socket_read($socket, 2048)."

"; + socket_close($socket); +} +else if (strlen($OUTPUT) > 0) { + echo "ACTION: "; + echo $output." too short"; +} + +$groups=array("00001", "00010"); +echo ""; +foreach($groups as $ig) { + echo ""; + for ($is=1; $is<=5; $is++) { + $socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP) or die("Could not create socket\n"); + socket_bind($socket, $source) or die("Could not bind to socket\n"); + socket_connect($socket, $target, $port) or die("Could not connect to socket\n"); + + $output = $ig."0".$is."2"; + socket_write($socket, $output, strlen ($output)) or die("Could not write output\n"); + $state = socket_read($socket, 2048); + if ($state == 0) { + $color=" BGCOLOR=\"#FF0000\""; + $action = 1; + } + if ($state == 1) { + $color=" BGCOLOR=\"#00FF00\""; + $action = 0; + } + echo ""; +} +echo "
"; + echo "".$ig.":".$is."
=> ".$action."
"; + socket_close($socket); + } + echo "
"; +?> + +