Просмотр файла smile/funct.php

Размер файла: 1.24Kb
<?php
function option($dir){
$conf["items_per_page"] = 99;

if(!($dp = opendir("./".$dir))) die ("Cannot open ./".$dir);
$file_array = array();
while ($file = readdir ($dp))

        {

       if(substr($file,0,1) != '.' and $file != '..' and $file != 'index.php')

                {

                $file_array[] =  $file;

                }

        }
$file_count = count ($file_array);
sort ($file_array);
                if ($file_count > 0)
                        {
                        $first_record = $page * $conf["items_per_page"];
                        $last_record = $first_record + $conf["items_per_page"];
                        while (list($fileIndexValue, $file_name) = each ($file_array))
                                {
                                if (($fileIndexValue >= $first_record) AND ($fileIndexValue < $last_record))
                                        {
                                        $real_file_name = explode ('.', $file_name);
                                        echo '<option value="'.$real_file_name[0].'">'.$real_file_name[0].'</option>';
                                        }
                                }



                        }

closedir($dp);
}

?>