Jump to content

Recommended Posts

 

Actually, you might should use shell_exec.

 

Don't think I'm understanding it correctly...

<?php
$output= shell_exec('test.bat');
echo $output;
?>

 

Should execute test.bat, which simply creates a new folder.  But when I open the page, no folder is created.

Yeah, its top of my head coding.

I missed a end quote

<?php
echo getcwd() . '/test.bat does ' . (is_file('test.bat')?'':''not ') . 'exist.';
?>

 

if it exists, than ya may want to check safe mode in php.ini and disable it or create an executable dir so php can run external apps

 

 

Yeah, its top of my head coding.

I missed a end quote

<?php
echo getcwd() . '/test.bat does ' . (is_file('test.bat')?'':''not ') . 'exist.';
?>

 

if it exists, than ya may want to check safe mode in php.ini and disable it or create an executable dir so php can run external apps

 

Thanks, but still getting a parse error

I've got it to work with..

<?php
echo exec('cmd /c test.bat');
?>

 

But...

I am unable to pass parameters to it.  If I hard code them in, it works fine, but I am trying to submit them from a form, and it loads filename.php?Parameter1=a&Parameter2=b

 

So my code is:

<?php
echo exec('cmd /c test.bat $Parameter1 $Parameter2');
?>

 

But this doesn't seem to work?

 

 

Or you could just do what ever the batch file does in PHP.

 

 

As far as I know, there isn't anything a batch file does that PHP can't.

 

 

By the way, the cmd /c probably wouldn't be needed with shell_exec().

 

 

Anyway, it looks like your code is relying on register_globals, and that setting is just straight up evil when set to on.  Find a tutorial on $_GET.

 

Short explanation:

 

somepage.php?foo=bar

 

$_GET['foo'] would be "bar"

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.