Jump to content

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


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 <?

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.