note 37015 deleted from function.shell-exec by didou

From: Date: Thu, 30 Oct 2003 21:31:12 +0000
Subject: note 37015 deleted from function.shell-exec by didou
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-59539@lists.php.net to get a copy of this message
Note Submitter: nunya bizzy ---- 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.

« previous php.notes (#59539) next »