There does not appear to be consistency over the query-string used to initiate the source list, that example uses "&source=view", but I have seen "&sce=view", "&view=sce", "&view=src" and "&src=view" used amongst a handful of others. Most people who implement PHP on their web-sites do so because you can use several 'require' or 'include' to include several bits of common content on as many of their web pages as appropriate. The self-downloader only lists the PHP source of a single file, not all the PHP sources involved in creating that web page. If you try each of the query-strings I have just quoted on a page you are looking at on the internet, it may be ignored, or it might list an included file rather than the main script producing the web page. It depends which script file includes the above code, and if more than one of the php script files includes the above code, I suspect it is the first file parsed that is actually listed.

Can I propose an alternative, a way to view the source of any of the scripts making up any web page.* I wanted to be able to decide script by script whether its source could be viewed (to exclude those containing passwords or other material that you would expect to remain hidden). * I wanted to be able to choose which of the various scripts in any web page got listed by selecting the relevant script using a query-string. * I wanted a way to optionally list the range of possible query-strings (for when I could not remember which scripts were included in a particular web page). * Finally I needed the downloader to know the path names for each file as my individual scripts are not all in the same directory.

In those individual scripts that offer viewing its source, I include something equivalent to this (you can tailor it according to which query-string selector you prefer):

include_once 'sourceView.php'; $this_file = "xxxx.php"; add_source(__FILE__, $this_file); // Tells included file that it can display the source of the current file # __FILE__ represents the full path name, $this_file is the final part of the file-name and is what you specify in the query-string to request the source of this file if ( isset($_GET['view']) && $_GET['view'] == $this_file or isset($_GET['sce']) && $_GET['sce'] == $this_file or isset($_REQUEST['src']) && $_REQUEST['src'] == $this_file) { display_source ($this_file); // Tells included file that it is the source of this file that you want now }

The two functions add_source(x,y) and display_source(y) are defined in the included file 'sourceView.php' (mine is slightly more complicated, because I add some formatting), that also defines a global array and can use an optional global variable (that I assign an arbitrary value to, in one of the scripts making up the page, when I want to be prompted with list of query-strings available):

I am not quoting any licence with my code, as it basically just uses standard PHP (with very little interllectual design content), and I would be pleased if this was used more widely to make it easier for amateurs experimenting with programming like myself to share code. However, it did need an eureka moment for me to work out that I could deal with my path-name uncertainty by storing the path name in an array together with a shorter-name appropriate to use in a query-string, so I would not want anybody else to use that little bit that is my idea for their own profit!