PHP Command Line

Any problem with PHP can be disscused here
Tails5
Posts: 1302
Joined: Wed Mar 15, 2006 8:09 am
Contact:

PHP Command Line

Post by Tails5 »

I've made a php script, which executes things on my computer, for when I'm not at home. But I need a little help making it do exactly what I want, I'd like it to automatically scale the textarea and input box to the users browser, and be able to fully emulate the command line so I can type "cd .." and all that to navigate around instead of having to remember the exact path of everything, and also to keep the previous output, along with the command entered, as if it were really cmd.exe. It's source code is:[php]<html>
<head>
<title>
Command Script
</title>
</head>
<body bgcolor="#000">
<form action="run.php" method="post">
<textarea name="text" rows=20 cols="60" disabled="disabled"><?php
passthru($_POST['run']);
?></textarea>


<input type="text" name="run" size=80 />
</form>
</body>
</html>[/php]The file is run.php, it redirects to itself to run the arguments. If anyone can help me, it would be greatly appreciated. I run Windows XP Home, with Apache2.2 and PHP 5.2.5.


Webmaster Yoda: You must confront the cPanel. Then, and only then, a webmaster will you be.
Julius Caesar: Veni, vidi, posti
Lixas
Posts: 750
Joined: Wed Feb 16, 2005 4:21 pm

Post by Lixas »

in this case would be very good decision to use ajax. in your case, saja is perfect
Image
Tails5
Posts: 1302
Joined: Wed Mar 15, 2006 8:09 am
Contact:

Post by Tails5 »

While that's helpful, I don't know 'saja'. My web-design knowledge is limited to HTML, CSS, PHP, ASPX, and some Java
Webmaster Yoda: You must confront the cPanel. Then, and only then, a webmaster will you be.
Julius Caesar: Veni, vidi, posti
Lixas
Posts: 750
Joined: Wed Feb 16, 2005 4:21 pm

Post by Lixas »

saja is "Secure AJAX for PHP" You jus need to create a class that do all you job, and using saja's framework run that class and function. It's ajax based solution, so i think it's da best fo u

http://saja.sourceforge.net/demo/
Image
Tails5
Posts: 1302
Joined: Wed Mar 15, 2006 8:09 am
Contact:

Post by Tails5 »

Okay, I'll look into that, thanks Lixas :)
Webmaster Yoda: You must confront the cPanel. Then, and only then, a webmaster will you be.
Julius Caesar: Veni, vidi, posti
csoftdev
Posts: 28
Joined: Fri Dec 07, 2007 4:49 pm

Post by csoftdev »

won't it be too dangerous to allow commands to be executed that way? what if someone pass it delete command?
Tails5
Posts: 1302
Joined: Wed Mar 15, 2006 8:09 am
Contact:

Post by Tails5 »

:P My .htaccess file denies access from ANY computer unless they either have my IP address, or my password. So I'm safe :)
Webmaster Yoda: You must confront the cPanel. Then, and only then, a webmaster will you be.
Julius Caesar: Veni, vidi, posti
TheCrymsonLegends
Posts: 1246
Joined: Wed Feb 16, 2005 6:59 am

Post by TheCrymsonLegends »

That is odd, could I ask what exactly you would try to run on your computer when you are away from the computer? Unless you attempt to connect to your computer to be able to use it from another computer I wouldn't really see the point, but none the less I am still quite confused as to how this would be a good thing. Not even LAN Networks work good for sharing programs only files and connectivity to the internet, so I would love to hear what you are going to use this for so I can understand :D
Reached 5000 Credits! The highest of any member on Smokyhosts! New milestone for Me!
Tails5
Posts: 1302
Joined: Wed Mar 15, 2006 8:09 am
Contact:

Post by Tails5 »

Well mainly I want to be able to emulate teh command line to control things like... restarting Apache, SQL, and FTP, and query the status of services by using

Code: Select all

sc query <ServiceName>
and also I need to be in certain folders sometimes but the one I've got uses cmd.exe which defaults to C:\**** and Settings\Francisco\ for all of the commands, as it starts a new cmd.exe for each command I enter.
Webmaster Yoda: You must confront the cPanel. Then, and only then, a webmaster will you be.
Julius Caesar: Veni, vidi, posti
thetarget
Posts: 496
Joined: Sat Jul 09, 2005 9:10 am

Post by thetarget »

hey, thanks for sharing. A little turn and twist for security will be good. No doubt ht.access does its job, but another layer of security is better.
Post Reply