<?php
  function Relay1TurnOn() {
	  system('/kirac/api/ios_api 7');
  }

  function Relay1TurnOff() {
	  system('/kirac/api/ios_api 8');
  }

  function Relay2TurnOn() {
	  system('/kirac/api/ios_api 9');
  }

  function Relay2TurnOff() {
	  system('/kirac/api/ios_api 10');
  }
  
  $relay = $_POST['relay'];
  $state = $_POST['state'];
  
		
  if ($relay == 1) {
    if ($state == 1)Relay1TurnOn();
	if ($state == 0)Relay1TurnOff();
  }
  
  if ($relay == 2) {
    if ($state == 1)Relay2TurnOn();
	if ($state == 0)Relay2TurnOff();
  }
?>
