Exclude sitemap.php


<?php

$dir = $_SERVER['DOCUMENT_ROOT'] . '/pages/';
if($handle = opendir($dir))
{
    while($file = readdir($handle))
    {
        clearstatcache();
        if(is_file($dir.'/'.$file))
                         echo '<option>'.$file.'</option>';
    }
    closedir($handle);
}

?> 

In the list of files above (which is out of a form select box), I have a file called sitemap.php

I do not want people to be able to delete sitemap.php so how can I change the code above so that sitemap.php does not get displayed in the options?

Doh, I should have known that. I haven’t done PHP for a while, I am starting to forget things lol. Thanks heaps :slight_smile:

if(is_file($dir.‘/’.$file) && $file != ‘sitemap.php’)