running an .exe in php

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
stevelittrell
Forum Newbie
Posts: 4
Joined: Tue Mar 31, 2009 4:12 pm

running an .exe in php

Post by stevelittrell »

Hello All,

I have been working on my company intranet and would like to turn a field that is originally for a website into a field that you could enter an ip address and run vnc by clicking on the ip address that is entered. I am able to run the ip address through a command prompt using C:\Program Files\RealVNC\VNC4\vncviewer.exe xxx.xxx.xxx.xxx.

The Code that is currently in place is:


<?php if ( $this->contact->webpage && $this->params->get('show_webpage')) { ?>
<div id="contact-website" class="contact-other"><?php echo $mc . $this->params->get( 'marker_web' ); ?></div>
<a href="<?php echo $this->contact->webpage; ?>" target="_blank">
<?php echo $this->contact->webpage; ?></a></div>

<?php } ?>
<?php endif; ?>
User avatar
Apollo
Forum Regular
Posts: 794
Joined: Wed Apr 30, 2008 2:34 am

Re: running an .exe in php

Post by Apollo »

stevelittrell wrote:I am able to run the ip address through a command prompt using C:\Program Files\RealVNC\VNC4\vncviewer.exe xxx.xxx.xxx.xxx.
Exactly who is 'I', the webserver (which runs your php script) or the client (visitor who enters the IP) ?
stevelittrell
Forum Newbie
Posts: 4
Joined: Tue Mar 31, 2009 4:12 pm

Re: running an .exe in php

Post by stevelittrell »

I am running this through a command prompt on the client. I basically want to run an executable that is located on the client. Reason why it is located in the same path on every workstation that is located in my network.

Thanks
Mark Baker
Forum Regular
Posts: 710
Joined: Thu Oct 30, 2008 6:24 pm

Re: running an .exe in php

Post by Mark Baker »

If it's on the client, the answer is no; not with PHP.
I basically want to run an executable that is located on the client. Reason why it is located in the same path on every workstation that is located in my network.
Just consider the implications for the average hacker if it was possible.
stevelittrell
Forum Newbie
Posts: 4
Joined: Tue Mar 31, 2009 4:12 pm

Re: running an .exe in php

Post by stevelittrell »

This is for a company Intranet, which sits on an internal network and cannot be accessed from the outside world. I am not worried about hackers being able to access this because it sits behind our firewall and is only accessible to the users inside of our network.
User avatar
php_east
Forum Contributor
Posts: 453
Joined: Sun Feb 22, 2009 1:31 pm
Location: Far Far East.

Re: running an .exe in php

Post by php_east »

you would need some sort of browser plugin to execute the local executable file. javascipt and flash plugins do exactly that. you would need a DOS shell plugin, and i shudder to think when this pluign taken out from your intranet and installed in the internet, by accident or otherwise.

the other alternative is to use windows networking or some other networking protocol, which allows this kind of access. quite messy if you ask me, but if you can find a browsr shell pulgin, that would be marvelous, and hope you can share. i'm sure lots of good use can be put to it.
Mark Baker
Forum Regular
Posts: 710
Joined: Thu Oct 30, 2008 6:24 pm

Re: running an .exe in php

Post by Mark Baker »

stevelittrell wrote:This is for a company Intranet, which sits on an internal network and cannot be accessed from the outside world. I am not worried about hackers being able to access this because it sits behind our firewall and is only accessible to the users inside of our network.
You might not be worried; but if PHP was capable of this, not everybody has the pleasure of running PHP only on a local intranet, and they would all be subject to nastiness.

But the point is moot, PHP on the server cannot access anything on the client directly. To do this, you'd need an application running on the client already that did have privilege to access the client filesystem.
stevelittrell
Forum Newbie
Posts: 4
Joined: Tue Mar 31, 2009 4:12 pm

Re: running an .exe in php

Post by stevelittrell »

Thank you to everyone for all of the help that you have given. I feel that I am making progress, I have created a batch file that would call the program:

C:\"Program Files"\RealVNC\VNC4\vncviewer.exe
EXIT

The code that I used in the webpage is the following:

<?php if ( $this->contact->webpage && $this->params->get('show_webpage')) { ?>
<div id="contact-website" class="contact-other"><?php echo $mc . $this->params->get(
'marker_web' ); ?></div>

<a href="vnc.bat"><?php echo $this->contact->webpage; ?></a></div>

<?php } ?>
<?php endif; ?>

This allows me to pull up the program and the parameters (i.e. the ip address) shows up on the webpage and allows me to click on it. I am now trying to find a way to pass the parameters to the program. Typically when you type in C:\"Program Files"\RealVNC\VNC4\vncviewer.exe xxx.xxx.xxx.xxx it will automatically input the ip address, but since I have multiple IP's I am curious to know if there is a way to echo what you are clicking on.
Post Reply