Googlez
04-06-2015, 08:03 AM
Hey i need some help with why it wont start the batch file. I see it start the cmd.exe in the background, but when i go to check if its running the batch file that i designated its not. i know because im trying to make it run a RSPS Source run.bat, and it says the port is still open, meaning, there are no other sources open. Anyways, heres my code. If you got any tips please tell me!
<?php
session_start();
$id = $_GET['serverid'];
$mysqli = new mysqli("localhost", "root", "", "mainrspshosts");
/* check connection */
if ($mysqli->connect_errno) {
printf("Connect failed: %s\n", $mysqli->connect_error);
exit();
}
$query = "SELECT * FROM servers WHERE id = '" .$id. "' LIMIT 1";
if ($result = $mysqli->query($query)) {
/* fetch associative array */
while ($row = $result->fetch_assoc()) {
if($_SESSION["username"]==$row["owner"]){
set_time_limit(300);
$WshShell = new COM("WScript.Shell");
$run_cmd = "CMD 'c:\testserver\run.bat' ";
$WshShell = $WshShell->Run($run_cmd, 1, false);
header("refresh:5;url=http://.zapto.org/ucp/serverstartedvalidation.php");
}
else{
header("location:index.php");
}
}
}
else{
header("location:index.php");
}
?>
<?php
session_start();
$id = $_GET['serverid'];
$mysqli = new mysqli("localhost", "root", "", "mainrspshosts");
/* check connection */
if ($mysqli->connect_errno) {
printf("Connect failed: %s\n", $mysqli->connect_error);
exit();
}
$query = "SELECT * FROM servers WHERE id = '" .$id. "' LIMIT 1";
if ($result = $mysqli->query($query)) {
/* fetch associative array */
while ($row = $result->fetch_assoc()) {
if($_SESSION["username"]==$row["owner"]){
set_time_limit(300);
$WshShell = new COM("WScript.Shell");
$run_cmd = "CMD 'c:\testserver\run.bat' ";
$WshShell = $WshShell->Run($run_cmd, 1, false);
header("refresh:5;url=http://.zapto.org/ucp/serverstartedvalidation.php");
}
else{
header("location:index.php");
}
}
}
else{
header("location:index.php");
}
?>