RE: [PHP-WIN] Showing source code with .phps extension

From: Date: Mon, 19 Mar 2001 18:33:50 +0000
Subject: RE: [PHP-WIN] Showing source code with .phps extension
Groups: php.windows 
Request: Send a blank email to php-windows+get-6147@lists.php.net to get a copy of this message
You can try adding a new handler to 'take care' of .phps: Action show-code /whatever/sourcify.php AddHandler show-code .phps The sourcify.php would be something like this: <HTML> <HEAD> <TITLE> Source Display </TITLE> </HEAD> <BODY BGCOLOR="white"> <?php $script = getenv( "PATH_TRANSLATED" ); if(!$script) { echo "<BR><B>ERROR: Script Name needed</B><BR>"; } else { if (ereg("(\.php|\.phps|\.inc)$",$script)) { echo "<H1>Source of: $PATH_INFO</H1>\n<HR>\n"; highlight_file($script); } else { echo "<H1>ERROR: Only PHP or include script names are allowed</H1>"; } } echo "<HR>Processed: ".date("Y/M/d H:i:s",time()); ?> </BODY> </HTML> For more information, check out 'Action' and 'AddHandler' on your Apache documentation. This has the advantage that you can add your own header/footer information so that the page does not look so 'detached' from your site... In fact, this is how I'm going to do it from now on!! HTH, Fernando Madruga -----Original Message----- From: Anders Pettersson [mailto:anders.pettersson@hik.se] Sent: segunda-feira, 19 de Março de 2001 18:12 To: php-windows@lists.php.net Subject: Re: [PHP-WIN] Showing source code with .phps extension Thanks for your answer, but I don't run PHP as a module, but rather as CGI. If I follow your advise, my phps files get parsed as usual, they don't show the source code. At the moment I'm solving it with the highlight() command, but that is not an optimal solution... Regards Anders Pettersson -- PHP Windows Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-windows-unsubscribe@lists.php.net For additional commands, e-mail: php-windows-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net

« previous php.windows (#6147) next »