Jump to content

use of the exec() and or proc_open() function.


fusioneko

Recommended Posts

<?php
f($_POST['startup']){
	if(!$online){
		//$A1 = array();
		//exec($servpath."khyller-server.exe") or die("<BR>Server Startup MSG - <Font color=red>Cannot find Server</font>");
		//proc_open("call C:\Server\blanked\release\khyller-server.exe", $A1,$A2,$A3);
	}
}
?>

I'm first trying to get them to work at all just do something first. but with no success  I even sued or die and all I get is die D: Is it impossible or am I just dumb? I know I did this one, But I don't know how.

 

Edit to add php color.. my eyes were hurting in blackness.

<?php
require_once("config.php");
if($_GET['page']=="Checkserv"){
$up = fsockopen($servip, $servPort, $errno, $errstr, 1);// or die("Server Connection:<Font color=red><B>FAILED</B></Font>");
if($up){
	echo "<BR>Server <Font color=green>Online</Font>";
	$online = 1;
} else {
	echo "<BR>Server <Font color=red>Offline</Font>";
	$online = 0;
}
if($_POST['startup']){
	if(!$online){
		$descriptorspec = array(
0 => array("pipe", "r"),
1 => array("pipe", "w"),
2 => array("file", "error.txt", "a")
);
		$pipes = null;
		$cwd = $servpath;
		$env = null;
		$ooption = array("Context");
		//exec($servpath."khyller-server.exe") or die("<BR>Server Startup MSG - <Font color=red>Cannot find Server</font>");
		$process = proc_open("khyller-server.exe", $descriptorspec,$pipes,$cwd,$env, $ooption);


	}
}
if(!$online){
	echo "<form action=Admin.php?page=Checkserv method=post><BR>";
	echo "<input type=submit name=startup value=StartServer></form>";
} else {
	//
}
}
?>

 

So far I got an understanding how to use proc_open, but I wanna keep it open, any idea to make it so php doesn't hang?

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.