LEDColors/setcolor.php

25 lines
568 B
PHP

<?php
require 'header.php';
if ( !isset($_REQUEST['c']) ) exit();
if ( !isset($_REQUEST['t']) ) exit();
$hex = $_REQUEST['c'];
$targets = $_REQUEST['t'];
$command = 0x01;
$unique = mt_rand(1, 2000000000);
$red = hexdec(substr($hex, 0, 2));
$green = hexdec(substr($hex, 2, 2));
$blue = hexdec(substr($hex, 4, 2));
foreach ( $targets as $target ) {
$target = intval($target);
$unique = mt_rand(1, 2000000000);
$data = pack("LLLCLLCCC", PACKETFILTER[0], PACKETFILTER[1], $unique, $command, $target, 1, $red, $green, $blue);
transmitMessage($data);
}
?>