Is it possible to use suPHP to return an entire HTML file?

85 views Asked by At

For the sake of argument, lets assume that I can't change my file permissions. Furthermore, assume all my .html files have the permission 0700 like so:

-rwx------ 1 user user 0 2012-01-09 19:50 aquinas.html
-rwx------ 1 user user 0 2012-01-09 19:50 daedalus.html
-rwx------ 1 user user 0 2012-01-09 19:50 helios.html
-rwx------ 1 user user 0 2012-01-09 19:50 icarus.html
-rwx------ 1 user user 0 2012-01-09 19:50 index.html
-rwxr-xr-x 1 user user 0 2012-01-09 19:52 require.php

Therefore I can't access my index.html file simply by typing www.example.com/index.html in my browser. What I can do, however, is set up a require.php file in the main web folder and set its permission to 0755. Lets assume this require.php file finds the specified .html file and returns its full contents. Assume also that I have suPHP running. Then I could call require.php --as the owner of require.php-- fetch the contents of, for example, index.html, and pass it to the calling browser. I know require.php is capable of fetching the file contents serverside. What I want to know is whether it can return the contents as an html file for the browser to load?

1

There are 1 answers

1
vzwick On BEST ANSWER

Why don't you try this:

<?php // your require.php
echo file_get_contents('index.html');
exit();