<li><a href="/lights.php">Lights</a></li> </ul> </div><!--/.nav-collapse --> </div> </nav> <div class="container"> <p> <a class="btn btn-success btn-lg" href="?command=KEY_POWER">Power</a> <a class="btn btn-success btn-lg" href="?command=KEY_VOLUMEUP">Volume Up</a> <a class="btn btn-success btn-lg" href="?command=KEY_VOLUMEDOWN">Volume Down</a> <a class="btn btn-success btn-lg" href="?command=KEY_TAPE">Use TV Audio</a> <a class="btn btn-success btn-lg" href="?command=KEY_AUX">Use AirPlay Audio</a> <a class="btn btn-success btn-lg" href="?command=KEY_CD">Listen to a CD</a> <a class="btn btn-success btn-lg" href="?command=KEY_EJECTCD">Eject CD</a> </p> </div> <!-- /container --> <!-- Bootstrap core JavaScript ================================================== --> <!-- Placed at the end of the document so the pages load faster --> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script> <script src="/assets/js/bootstrap.min.js"></script> </body> </html>'; include 'assets/scripts/functions.php'; if (isset($_GET['command'])) { irsend("STEREO", $_GET['command']); } echo $page;
function irmacro($macro) { switch ($macro) { case tv: $file = fopen("on.txt", "r") or die("unable to work properly"); $on = fread($file, filesize("on.txt")); fclose($file); if ($on == 100) { irsend("STEREO", "KEY_POWER"); $file = fopen("on.txt", "w") or die("unable to work properly"); fwrite($file, "110"); fclose($file); } elseif ($on == 010) { irsend("TV", "KEY_POWER"); $file = fopen("on.txt", "w") or die("unable to work properly"); fwrite($file, "110"); fclose($file); sleep(10); } elseif ($on == 00) { irsend("TV", "KEY_POWER"); usleep(50000); irsend("STEREO", "KEY_POWER"); $file = fopen("on.txt", "w") or die("unable to work properly"); fwrite($file, "110"); fclose($file); sleep(10); } irsend("TV", "KEY_T"); irsend("STEREO", "KEY_TAPE"); break; case dvd: $file = fopen("on.txt", "r") or die("unable to work properly"); $on = fread($file, filesize("on.txt")); fclose($file); if ($on == 100) { irsend("STEREO", "KEY_POWER"); irsend("DVD", "KEY_POWER"); $file = fopen("on.txt", "w") or die("unable to work properly"); fwrite($file, "111"); fclose($file); } elseif ($on == 010) { irsend("TV", "KEY_POWER"); irsend("DVD", "KEY_POWER"); $file = fopen("on.txt", "w") or die("unable to work properly"); fwrite($file, "111"); fclose($file); sleep(10); } elseif ($on == 00) { irsend("TV", "KEY_POWER"); usleep(50000); irsend("STEREO", "KEY_POWER"); usleep(5000); irsend("DVD", "KEY_POWER"); $file = fopen("on.txt", "w") or die("unable to work properly"); fwrite($file, "111"); fclose($file); sleep(10); } elseif ($on == 110) { irsend("DVD", "KEY_POWER"); $file = fopen("on.txt", "w") or die("unable to work properly"); fwrite($file, "111"); fclose($file); } irsend("TV", "KEY_C"); usleep(1000000); irsend("TV", "KEY_H"); usleep(5000); irsend("STEREO", "KEY_TAPE"); break; case laptop: $file = fopen("on.txt", "r") or die("unable to work properly"); $on = fread($file, filesize("on.txt")); fclose($file); if ($on == 100) { irsend("STEREO", "KEY_POWER"); $file = fopen("on.txt", "w") or die("unable to work properly"); fwrite($file, "110"); fclose($file); } elseif ($on == 010) { irsend("TV", "KEY_POWER"); $file = fopen("on.txt", "w") or die("unable to work properly"); fwrite($file, "110"); fclose($file); sleep(10); } elseif ($on == 00) { irsend("TV", "KEY_POWER"); usleep(5000); irsend("STEREO", "KEY_POWER"); $file = fopen("on.txt", "w") or die("unable to work properly"); fwrite($file, "110"); fclose($file); sleep(10); } irsend("TV", "KEY_C"); usleep(1000000); irsend("TV", "KEY_H"); usleep(1000000); irsend("TV", "KEY_H"); usleep(5000); irsend("STEREO", "KEY_TAPE"); break; case wii: $file = fopen("on.txt", "r") or die("unable to work properly"); $on = fread($file, filesize("on.txt")); fclose($file); if ($on == 100) { irsend("STEREO", "KEY_POWER"); $file = fopen("on.txt", "w") or die("unable to work properly"); fwrite($file, "110"); fclose($file); } elseif ($on == 010) { irsend("TV", "KEY_POWER"); $file = fopen("on.txt", "w") or die("unable to work properly"); fwrite($file, "110"); fclose($file); sleep(10); } elseif ($on == 00) { irsend("TV", "KEY_POWER"); usleep(5000); irsend("STEREO", "KEY_POWER"); $file = fopen("on.txt", "w") or die("unable to work properly"); fwrite($file, "110"); fclose($file); sleep(10); } irsend("TV", "KEY_C"); irsend("STEREO", "KEY_TAPE"); break; case poweroff: $file = fopen("on.txt", "r") or die("unable to work properly!"); $on = fread($file, filesize("on.txt")); if ($on == 111) { irsend("TV", "KEY_POWER"); irsend("STEREO", "KEY_POWER"); irsend("DVD", "KEY_POWER"); } elseif ($on == 110) { irsend("TV", "KEY_POWER"); irsend("STEREO", "KEY_POWER"); } elseif ($on == 101) { irsend("TV", "KEY_POWER"); irsend("DVD", "KEY_POWER"); } elseif ($on == 100) { irsend("TV", "KEY_POWER"); } elseif ($on == 011) { irsend("STEREO", "KEY_POWER"); irsend("DVD", "KEY_POWER"); } elseif ($on == 010) { irsend("STEREO", "KEY_POWER"); } elseif ($on == 01) { irsend("DVD, KEY_POWER"); } elseif ($on == 00) { } else { die("Well, somthing went wrong"); } fclose($file); $file = fopen("on.txt", "w") or die("unable to work properlyish!"); fwrite($file, "000") or die("i suck"); fclose($file); break; } }
</div><!--/.nav-collapse --> </div> </nav> <div class="container"> <p> <a class="btn btn-success btn-lg" href="?command=KEY_POWER">Power</a> <a class="btn btn-success btn-lg" href="?command=KEY_UP">Up</a> <a class="btn btn-success btn-lg" href="?command=KEY_DOWN">Down</a> <a class="btn btn-success btn-lg" href="?command=KEY_LEFT">Left</a> <a class="btn btn-success btn-lg" href="?command=KEY_RIGHT">Right</a> <a class="btn btn-success btn-lg" href="?command=KEY_ENTER">Select</a> <a class="btn btn-success btn-lg" href="?command=KEY_PLAYPAUSE">Play/Pause</a> <a class="btn btn-success btn-lg" href="?command=KEY_MENU">Menu</a> <a class="btn btn-success btn-lg" href="?command=KEY_STOP">Stop</a> </p> </div> <!-- /container --> <!-- Bootstrap core JavaScript ================================================== --> <!-- Placed at the end of the document so the pages load faster --> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script> <script src="/assets/js/bootstrap.min.js"></script> </body> </html>'; include 'assets/scripts/functions.php'; if (isset($_GET['command'])) { irsend("DVD", $_GET['command']); } echo $page;