Im trying to execute a .exe file using php. Now It executes the application but it just sits there. Is there a way to force php to execute it and then timeout or somthing?
code:
<?
function form() {
?>
<form name="login" action="index.php" method="post">
<table width="278" border="0" align="center" cellpadding="0" cellspacing="1">
<tr align="left" valign="top">
<td width="115" bgcolor="#AEC7D9"><strong><font color="#FFFFFF" size="2" face="Arial, Helvetica, sans-serif"> Local
Port</font></strong></td>
<td width="160" bgcolor="#DCE7EF">
<input name="lport" type="text" id="lport" size="6">
</td>
</tr>
<tr align="left" valign="top">
<td bgcolor="#AEC7D9"><strong><font color="#FFFFFF" size="2" face="Arial, Helvetica, sans-serif"> Remote
IP</font></strong></td>
<td bgcolor="#DCE7EF">
<input name="rip" type="text" id="rip" value="0.0.0.0" size="15"></td>
</tr>
<tr align="left" valign="top">
<td bgcolor="#AEC7D9"><strong><font color="#FFFFFF" size="2" face="Arial, Helvetica, sans-serif"> Remote
Port</font></strong></td>
<td bgcolor="#DCE7EF">
<input name="rport" type="text" id="rport" size="6"></td>
</tr>
<tr align="center" bgcolor="#AEC7D9">
<td colspan="2">
<input type="submit" name="Submit" value="Submit">
<input type="reset" name="Submit2" value="Reset">
</td>
</tr>
</table></form>
<?
}
if ($_REQUEST[Submit] == "Submit") {
if ($_REQUEST[rip] == "" or $_REQUEST[rip] == "0.0.0.0") {
echo "<center>IP is wrong!</center><br>";
//Show Form if somthing is wrong
form();
} else {
//Show All Requests
echo "Starting Local Port on: ".$_REQUEST[lport]."<br>";
echo "Starting Remote IP on: ".$_REQUEST[rip]."<br>";
echo "Starting Remote Port on: ".$_REQUEST[rport]."<br>";
echo "Starting Port mapper...<br><br>";
echo "You may now close or stop the web browser.";
sleep(5); //Does not help with displaying with the above ^^^
//Execute program
exec("pm.exe ".$_REQUEST[lport]." ".$_REQUEST[rip]." ".$_REQUEST[rport]);
}
} else {
form();
}
?>
Now this software once ran will always run until manual closed. Its not a standard application. This routes ip's and ports so its always running once ran. Could this be the problem?
Oh if it is, is there a way to echo out the stats before it executes, the following above doesnt echo out.