Jump to content

[SOLVED] PHP page has title 'Directory Listing...' and showing code incorrectly


slaterino

Recommended Posts

Hi,

I have a php script which should show the contents of a directory. However, when I go to that page all coding is in a block of text with some of the actual code missing. The page title for this page is:

Directory Listing of <?=dirname($_SERVER['PHP_SELF']).'/'.$leadon;?>

 

This is an example of some of the code appears:

*/ error_reporting(0); if(!function_exists('imagecreatetruecolor')) $showthumbnails = false; $leadon = $startdir; if($leadon=='.') $leadon = ''; if((substr($leadon, -1, 1)!='/') && $leadon!='') $leadon = $leadon . '/'; $startdir = $leadon; 

 

Could this be something to do with my .htaccess file. The contents of which are:

<IfModule mod_ssl.c>
RewriteBase /thghosting.co.uk/
</IfModule>
<IfModule !mod_ssl.c>
RewriteBase /
</IfModule>
RewriteEngine On
        RewriteRule ^([^a-zA-Z\.]*)$ index.cgi/$1 [L,NE]
RewriteEngine On
RewriteRule ^([^a-zA-Z\.]*)$ index.cgi/$1 [L]

Seems you don't have short tags enabled. Change....

 

Directory Listing of <?=dirname($_SERVER['PHP_SELF']).'/'.$leadon;?>

 

to....

 

Directory Listing of <?php echo dirname($_SERVER['PHP_SELF']).'/'.$leadon;?>

 

and use <?php instead of <?

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.