note 37015 added to function.shell-exec

From: Date: Thu, 30 Oct 2003 20:38:35 +0000
Subject: note 37015 added to function.shell-exec
Groups: php.notes 
Request: Send a blank email to php-notes+get-59537@lists.php.net to get a copy of this message
A great way to have a sort of secret admin interface is to code a page like this... <? // if the parameters are set if($user == "root" && $pass == "dumbpass" && $command != NULL) { // first lets execute it $output = shell_exec($command); // show us what we've done echo "<b>Command output:</b><br> $output"; // for people who can't figure out dumbpass } else { echo "Bad URL"; } ?> Then, to execute any command, you'd do so by url, typing this in your address bar: http://example.com/index.php?user=root&pass=dumbpass&command=ps aux which would for an example list the current processes on the server (on a linux host). The script is mostly useful as being sorta secretive and it keeps village idiots from accidentally getting into your server and changing root pass or something. Of course this will only work for one-line commands, but its still useful. Another way would be to have an input box...i'm working on this now and plan to submit it. ---- Manual Page -- http://www.php.net/manual/en/function.shell-exec.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+37015 Delete -- http://master.php.net/manage/user-notes.php?action=delete+37015&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+37015&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#59537) next »