Hello everyone My OS information is PHP Version 5.1.6 Apache/2.2.2 (Fedora) Fedora Core 5 Kernel 2.6.20-1.2307.fc5 I am having some trouble with a script that displays files within a directory. the script does not appear to be displaying large files and the date thaty is displayed on these large files is Dec-31-69 I did not create the script I downloaded it from www.celerondude.com/php-indexer I also tried to get some assistance from the authors site but have not been repsonded to yet, so I thought I would try here. The script itself is using php readdir and some javascript functions which is why I am so confused. the main portions of the script is <?php // This block MUST be at the very top of the page! @ob_start('ob_gzhandler'); if(isset($_GET['icon'])) { $e=$_GET['icon']; $I['file']='ENCODED gif files (*** I REMOVED to save SPACE ***)'; header('Cache-control: max-age=2592000'); header('Expires: '.gmdate('D, d M Y H:i:s \G\M\T',time()+2592000)); header('Content-type: image/gif'); print base64_decode(isset($I[$e])?$I[$e]:$I['file']); exit; } // End block // Start configs $sitename='BACKUPS'; $date='M-d-y'; // date format // $ignore=array('.','..','.htaccess','index.php','icon.php','iconup.php',' netdirs.php','main.css','index.html','Thumbs.db'); // ignore these files $ignore=array('.','..'); // End configs // $root=dirname(__FILE__); $root="/archive1/AutoBackups"; $dir=isset($_GET['dir'])?$_GET['dir']:'';if(strstr($dir,'..'))$dir=''; $path="$root/$dir/"; $dirs=$files=array(); if(!is_dir($path)||false==($h=opendir($path)))exit('Directory does not exist.'); while(false!==($f=readdir($h))) { if(in_array($f,$ignore))continue; if(is_dir($path.$f))$dirs[]=array('name'=>$f,'date'=>filemtime($path.$f),'url'=>'/backupdirs1.php?dir='.rawurlencode(trim("$dir/$f",'/'))); else$files[]=array('name'=>$f,'size'=>filesize($path.$f),'date'=>filemtime($path.$f),'url'=>trim("$root/$dir/".rawurlencode($f),'/')); } closedir($h); $current_dir_name = basename($dir); $up_dir=dirname($dir); $up_url=($up_dir!=''&&$up_dir!='.')?'/backupdirs1.php?dir='.rawurlencode($up_dir):'/backupdirs1.php'; // END PHP ?> Then within the actual HTML I have the following javascript <script type="text/javascript"> <!-- var _c1='#fefefe'; var _c2='#fafafa'; var _ppg=25; var _cpg=1; var _files=[]; var _dirs=[]; var _tpg=null; var _tsize=0; var _sort='date'; var _sdir={'type':0,'name':0,'size':0,'date':1}; var idx=null; var tbl=null; function _obj(s){return document.getElementById(s);} function _ge(n){n=n.substr(n.lastIndexOf('.')+1);return n.toLowerCase();} function _nf(n,p){if(p>=0){var t=Math.pow(10,p);return Math.round(n*t)/t;}} function _s(v,u){if(!u)u='B';if(v>1024&&u=='B')return _s(v/1024,'KB');if(v>1024&&u=='KB')return _s(v/1024,'MB');if(v>1024&&u=='MB')return _s(v/1024,'GB');return _nf(v,1)+' '+u;} function _f(name,size,date,url,rdate){_files[_files.length]={'dir':0,'name':name,'size':size,'date':date,'type':_ge(name),'url':url,'rdate':rdate,'icon':'/backupdirs1.php?icon='+_ge(name)};_tsize+=size;} function _d(name,date,url){_dirs[_dirs.length]={'dir':1,'name':name,'date':date,'url':url,'icon':'/backupdirs1.php?icon=dir'};} function _np(){_cpg++;_tbl();} function _pp(){_cpg--;_tbl();} function _sa(l,r){return(l['size']==r['size'])?0:(l['size']>r['size']?1:-1);} function _sb(l,r){return(l['type']==r['type'])?0:(l['type']>r['type']?1:-1);} function _sc(l,r){return(l['rdate']==r['rdate'])?0:(l['rdate']>r['rdate']?1:-1);} function _sd(l,r){var a=l['name'].toLowerCase();var b=r['name'].toLowerCase();return(a==b)?0:(a>b?1:-1);} function _srt(c){switch(c){case'type':_sort='type';_files.sort(_sb);if(_sdir['type'])_files.reverse();break;case'name':_sort='name';_files.sort(_sd);if(_sdir['name'])_files.reverse();break;case'size':_sort='size';_files.sort(_sa);if(_sdir['size'])_files.reverse();break;case'date':_sort='date';_files.sort(_sc);if(_sdir['date'])_files.reverse();break;}_sdir[c]=!_sdir[c];_obj('sort_type').style.fontStyle=(c=='type'?'italic':'normal');_obj('sort_name').style.fontStyle=(c=='name'?'italic':'normal');_obj('sort_size').style.fontStyle=(c=='size'?'italic':'normal');_obj('sort_date').style.fontStyle=(c=='date'?'italic':'normal');_tbl();return false;} function _head() { if(!idx)return; _tpg=Math.ceil((_files.length+_dirs.length)/_ppg); idx.innerHTML='<div class="rounded gray" style="padding:5px 10px 5px 7px;color:#202020">' + '<p class="left">' + '<strong><?=$current_dir_name==''?$sitename:$current_dir_name?></strong><?=$dir!=''?' (<a href="'.$up_url.'">Back</a>)':''?><br />' + (_files.length+_dirs.length) + ' objects in this folder, ' + _s(_tsize) + ' total.' + '</p>' + '<p class="right">' + 'Sort: <span class="link" onmousedown="return _srt(\'name\');" id="sort_name">Name</span>, <span class="link" onmousedown="return _srt(\'type\');" id="sort_type">Type</span>, <span class="link" onmousedown="return _srt(\'size\');" id="sort_size">Size</span>, <span class="link" onmousedown="return _srt(\'date\');" id="sort_date">Date</span>' + '</p>' + '<div style="clear:both;"></div>' + '</div><div id="idx_tbl"></div>'; tbl=_obj('idx_tbl'); } function _tbl() { var _cnt=_dirs.concat(_files);if(!tbl)return;if(_cpg>_tpg){_cpg=_tpg;return;}else if(_cpg<1){_cpg=1;return;}var a=(_cpg-1)*_ppg;var b=_cpg*_ppg;var j=0;var html=''; if(_tpg>1)html+='<p style="padding:5px 5px 0px 7px;color:#202020;text-align:right;"><span class="link" onmousedown="_pp();return false;">Previous</span> ('+_cpg+'/'+_tpg+') <span class="link" onmousedown="_np();return false;">Next</span></p>'; html+='<table cellspacing="0" cellpadding="5" border="0">'; for(var i=a;i<b&&i<(_files.length+_dirs.length);++i) { var f=_cnt[i];var rc=j++&1?_c1:_c2; html+='<tr style="background-color:'+rc+'"><td><img src="'+f['icon']+'" alt="" /> <a href="'+f['url']+'">'+f['name']+'</a></td><td class="center" style="width:50px;">'+(f['dir']?'':_s(f['size']))+'</td><td class="center" style="width:70px;">'+f['date']+'</td></tr>'; } tbl.innerHTML=html+'</table>'; } <?php while(list(,$d)=each($dirs))print sprintf("_d('%s','%s','%s');\n",addslashes($d['name']),date($date,$d['date']),addslashes($d['url'])); ?> <?php while(list(,$f)=each($files))print sprintf("_f('%s',%d,'%s','%s',%d);\n",addslashes($f['name']),$f['size'],date($date,$f['date']),addslashes($f['url']),$f['date']);?> window.onload=function() { idx=_obj('idx'); _head(); _srt('name'); }; --> </script> The issue I am having is that large files report 0 bytes and incorrect values for date. I guess the first part is for me to understand what the script is doing. and I have been trying to do just that The section of code at the top that uses the readdir is what I think is part of the problem. filesize only supports files less then 2 GB according to http://us.php.net/manual/en/function.filesize.php which states int filesize ( string $filename ) Returns the size of the file in bytes, or FALSE (and generates an error of level E_WARNING) in case of an error. Note: Because PHP's integer type is signed and many platforms use 32bit integers, filesize() may return unexpected results for files which are larger than 2GB. For files between 2GB and 4GB in size this can usually be overcome by using sprintf("%u", filesize($file)). However due to the way the javascript function is used I am not sure how to correct this issue and incorporate it into what already works for the files less then 2 GB function _f(name,size,date,url,rdate){_files[_files.length]={'dir':0,'name':name,'size':size,'date':date,'type':_ge(name),'url':url,'rdate':rdate,'icon':'/backupdirs1.php?icon='+_ge(name)};_tsize+=size;} Any assistance and or direction would be much appreciated appreciated -- With regards, RobertMCol