I do not know much about PHP can someone help me. My question is what do I need to do to auto submit a php file and also close the page automatically.
this is what I have:
<?php
function sendMsg($args) {
$fp = fsockopen($args["host"],$args["port"], &$errno, &$errstr);
if (!$fp) { //Something didn't work....
echo "ERROR: $errno - $errstr\n";
exit;
} else {
fputs ($fp, "$args[pword]\n\r"); //Send the Password
fputs ($fp, "$args[command]\n\r");
// this is for not quite mode
fputs ($fp, "close\n\r\n\r"); //needed to close the connection
// fputs ($fp, "\n\r\n\r"); //needed to close the connection in quiet mode
}
fclose($fp);
return;
}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<body>
<?php
if (! isset ($host) )
{
?>
<form method="post" action="open1.php">
<table>
<tr><td>Hostname</td><td><input type=text name=host value="192.168.1.100"></td></tr>
<tr><td>Port</td><td><input type=text name=port value="9001"></td></tr>
<tr><td>Password</td><td><input type=text name=pword value="test"></td></tr>
<tr><td>Command</td><td><input type=text name=command value="open"></td></tr>
<input type=submit value="Send" name="go">
</tr></table>
</form>
<?php
}
else
{
sendMsg($HTTP_POST_VARS);
?>
Sending...
<?php
}
?>
</body>
Thank you for the help,
Alex