Greetings all,
I've created a PHP script to execute X-10 commands from a web site.
I get no errors from PHP, nor form the web server. Still, it does not execute.
I can run the command from a cmd window and it works fine.
So, it seems I have a disconnect between the script and the ahcmd.exe.
I'll post the code below, but am hoping some one can ask the right question(s) to get me looking in the right place.
<html>
<head>
<title>ActiveHome PHP Control</title>
</head>
<body>
<?php
if (!isset($_POST['hc']))
{
$_POST['hc'] = "A";
}
if (!isset($_POST['uc']))
{
$_POST['uc'] = "1";
}
if (!isset($_POST['cmd']))
{
$_POST['cmd'] = "Off";
}
?>
<form action="ahp.php" method="post">
<center>
<img src="./art/ahp_logo_204x65.png" width="204" height="65" alt="activehome pro php control">
<BR>
<table cellpadding="0" cellspacing="0" border="0" width="162">
<tr><td background="./art/mm162x64_roombaraqua.png" valign="top" align="center">
<font color="#FFFFFF"><B>PHP Control</B></font>
</td></tr>
<tr><td bgcolor="#d3c8a7">
<table cellpadding="2" cellspacing="0" border="0" width="100%">
<tr><td align="left">
<B>House Code</b>
</td><td align="right">
<select name="hc">
<option value="A">A</option>
<option value="B">B</option>
<option value="C">C</option>
<option value="D">D</option>
<option value="E">E</option>
<option value="F">F</option>
<option value="G">G</option>
<option value="H">H</option>
<option value="I">I</option>
<option value="J">J</option>
<option value="K">K</option>
<option value="L">L</option>
<option value="M">M</option>
<option value="N">N</option>
<option value="O">O</option>
<option value="P">P</option>
</select>
</td></tr>
<tr><td align="left">
<B>Unit Code</b>
</td><td align="right">
<select name="uc">
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
<option value="6">6</option>
<option value="7">7</option>
<option value="8">8</option>
<option value="9">9</option>
<option value="10">10</option>
<option value="11">11</option>
<option value="12">12</option>
<option value="13">13</option>
<option value="14">14</option>
<option value="15">15</option>
<option value="16">16</option>
</select>
</td></tr>
<tr><td align="left">
<B>Command</b>
</td><td align="right">
<select name="cmd">
<option value="On">ON</option>
<option value="Off">OFF</option>
</select>
</td></tr>
</table>
</td></tr>
<tr><td align="center" bgcolor="#d3c8a7">
<input type="text" size="15" value="<?php echo $_POST['hc'].$_POST['uc']." ".$_POST['cmd']; ?>">
</td></tr>
<tr><td align="right" bgcolor="#d3c8a7">
<input type="submit" value="Run"/>
</td></tr>
</table>
</center>
</form>
<?php $cmdstring = $_POST['hc'].$_POST['uc']." ".$_POST['cmd'];
exec ("ahcmd.exe sendplc $cmdstring");?>
</body>
</html>