Jump to content

Recommended Posts

Hi, passthru() seems to not be working anymore for this, but this is what I need done...

 

I need to be able to make the user be able to click a button, which then launches a batch file on my computer.. But passthru() doesnt do the job anymore. And is faulty.. My computer is the server, so it'd also be nice if the command could launch it in a windowed form instead of a background process :-\

 

Here's my code.

 

<?PHP
if($_POST['shutdown']){
$command = 'cmd\stop.bat';
passthru($command);
} else if($_POST['on']){
$command = '..\..\GSV001\run.bat';
passthru($command);

}

?>


<form method='post'>

<input type='submit' name='shutdown' value='Shutdown' /> 
<input type='submit' name='on' value='Turn On' />

</form>

 

"On", for example.. Launches a CMD but the server never turns on. Here's the batch content within it:

 

@echo off
ant run
pause

 

But yeah, that's basically it. Is there any function in PHP that works better than passthru()?

 

Link to comment
https://forums.phpfreaks.com/topic/54891-executing-a-program-remotely-with-php/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.