PHP/CFML Source Viewer
What is PHP?
PHP is an open source, server-side, HTML embedded, scripting language used to create dynamic Web pages. In an HTML document, PHP code is embedded into the HTML source document and interpreted by the web server, which generates the HTML document. Because PHP is executed on the server, the client cannot view the PHP code. The extension of a PHP file is “.php”
What is CFML?
CFML is also a server-side scripting language. The output of a CFML is an HTML document. CFML can also be used to generate other languages, such as XML, JavaScript and CSS. Files created with CFML have the file extension “.cfm“. Because CFML is executed on the server, the client cannot view the CFML source code.
Can you view the PHP source code from a Remote Server?
NO. Since PHP code is executed on the server, and its HTML output is sent to the browser, the PHP source code will not show on the browser´s side. It will not even show in a code grabber, as grabbers are only capable to grab the HTML output created by the PHP page. When you visit a Web PHP page, the server interprets the PHP code, and generates an output in HTML. The PHP itself cannot be downloaded. Same thing applies to a CFML.
If you have administrative access to that server, then you can view the PHP source code. If you don’t have access, then NO.
Since the only way you can see the PHP source code is from your own domain (or other domains that you have access). Then why do you need a PHP/CFML Source Viewer?
The objective of the PHP/CFML Source Viewer is to show others your PHP (or CFML) source code.
Instructions
If you decided to use the code below, the only changes you need to do is to edit the correct file names(s) and file path(s). Copy the code below and paste it to a text file, and name it “sourceviewer.php”. Then load it with the associated external files, into your server.
<?php
/************ FILENAME: sourceviewer.php ************/
/*
* The $files array is the only change you need to do.
* Write the correct file names, and the correct paths.
* This file and the external files should be in the
* same domain .
* Separate files by comma.
*/
$files = array(
'math.php', //external PHP file
'separatedirectory/randomize.cfm', //external ColdFusion file
);
/***************** END OF EDITING *****************/
/*****************************************************
* For GET requests, print a list of links to the files
* and a form button to submit the file name. For POST
* requests, show the source of the submitted file.
******************************************************/
NOTE: Some Web servers support the phps
extension. If this is the case then you don´t need the Source Viewer code above. All what you need is change the file extension from php
to phps
. If you are lucky, your web server might be configured to display the source of files with a phps
extension. This does not apply to ColdFusion files though.