note 20062 deleted from function.system by cmb

From: Date: Sun, 28 Jul 2019 08:23:44 +0000
Subject: note 20062 deleted from function.system by cmb
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-211749@lists.php.net to get a copy of this message
Note Submitter: z1a7n8g at / at a<o<l dot c<o<m ---- I am currently using a form driven administration page to start an ftp server remotely from a web page in FreeBSD 4.5 using PHP 4.1.2 & apache 1.3.23. (Sorry guys, no CVS!!) This code will emulate a CLI command from your browser (anywhere!!) and execute it if your PHP module/binary has the correct permissions... <code><pre> //your front end <form ..your form stuff here...> <input type="text" name=command> <your additional form stuff> ///the gutz <? $arg=explode( " ", $command, 4 ) if ($arg[0] = "system") { system($arg[1] . " " . $arg[2] . " " . $arg[3]..etc); }?> </code></pre> This works, however it is simple and lacks any error output. try: <pre><code> <?system(command > /path/to/yourfile.php); $fPtr=@fopen("yourfile.php",r); $line=fgets($fPtr,filesize("yourfile.php"); while ($line) { $formatted_line=ereg_replace("your favorite newline semantic","<BR>",$line); print $formatted_line; } ?> </pre></code> Keep in mind the SECURITY implications with the use of this and like scripts. You've been warned.

« previous php.notes (#211749) next »