login  Naam:   Wachtwoord: 
Registreer je!
 Scripts:

Scripts > PHP > Handige scripts > Indexer

Indexer

Auteur: Celerondude - 01 september 2004 - 15:03 - Gekeurd door: Dennisvb - Hits: 4383 - Aantal punten: 2.33 (3 stemmen)




Gewoon, een Indexer,
credits gaan naar Celeron Dude

Code:
  1. <?php
  2. // begin config
  3. $root='./'; // waar browsen. ./ betekent waar het script ook mag zijn
  4. $rurl='./'; // url naar $root, ./ zal hetzelfde zijn
  5. $burl='index.php?'; // basis url, de url om de indexer te accessen als je hem include in een ander script
  6. $surl='index.php'; // absolute url ervan
  7. $incl=0; // include je deze indexer in een andere pagina, 1 voor ja, 0 voor nee, dan laat hij de html tags enzo weg
  8. $name='Directory Indexer v1.0'; // sitenaam, lijk me logisch
  9. # css styles ######################################################
  10. $css=<<<EOT
  11. body,td{font-family:tahoma,verdana,arial;font-size:11px;line-height:15px;background-color:white;color:#666666;margin-left:20px;}
  12. strong{font-size:12px;}
  13. a:link{color:#0066CC;}
  14. a:hover{color:#FF6600;}
  15. a:visited{color:#003366;}
  16. a:active{color:#9DCC00;}
  17. table.itable{}
  18. td.irows{height:20px;background:url("index.php?i=dots") repeat-x bottom}
  19. EOT;
  20. // einde config
  21. function e($s){$p=strrpos($s,'.');return substr($s,$p+1,strlen($s));}
  22. function s ($a,$c,$o='asc',$t=SORT_STRING){if(!isset($a[0][$c]))return $a;for ($i=0;$i<count($a);$i++)$temp[$i]=&$a[$i][$c];$o=($o=='asc')?SORT_ASC:SORT_DESC;array_multisort($temp,$o,$t,$a);return $a;}
  23. if (isset($_GET['i']))
  24. {
  25. $i=trim ( $_GET['i'] );
  26. $imgs['images']='R0lGODlhEAAQAPcAAP//////AP8A//8AAAD//wD/AAAA/wAAAPuBhP0RI7Crrr24vL25vn+CmJ6syZ6rxbfF4cbO3srO1oOk4WF4oo6fvpyuzqCvyqKxzKGwy6i30qa10KKxy6Oxy6Kwyb3M57G/2JyovqCswsTR6dDd9crW7NPe8tXg89Hb7uLs/u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zyUGOhyMaoPmDBs4c/TkAYbgl6gFUC4IrETnzZ48gvAMS0BMlgQjGQbmGiQn0CE/vIQF08QjBQeGsQD9gfSo0SJYvaj0wMBwFiVHjECFwkWLxREVtAcq8LQKUylTuppc8RFkw8UnOG6EEDGEhocZHWAEBAA7';
  27. $imgs['jpg']=&$imgs['images'];$imgs['gif']=&$imgs['images'];$imgs['png']=&$imgs['images'];$imgs['bmp']=&$imgs['images'];
  28. $imgs['htm']='R0lGODlhEAAQAPcAAFFRg1VVh1RVhldYiVpbi2lqm2BikGdpl25xnnN3o3yBq3l9p2JsnHN/sr3K/77K/3CAsrrK/8rY/8nX/sjW/bfM/8HQ9snY/8bV/MbV+7TM/7PF7KW54bDN/6K33oSj1q3N/5+02Cc8Woir3oep3KvN/6nO/5ulsjFcjyFDaSVDZbvO4+z1/ylrrD53sT9jiXSo3nOUtKHE5rrb+7/f/7TS8Mzl/4+gstPp/9vt//P5//3+/x1fmil6xC9yskGV5EZ3pShEXpS31qjG48Ti/9vq+OTy/+Hs9uz2/zCV7TKY7DqY6kKq/kiKxEqArkdriUpriHeauOjw9zKc7DGP2DSR2TGIzVCm5XCr2JatvyiW5T6p90im5kqItHCjyKDG4SWc5S6i61SVwFiWvCKR0ief5iWKwh5wnjCq8jyg2nzO+73X5nXH8oK10H6ux7bY6TK08ErB+W3E65jC1TKp3Tq57z667mzB5jzL/svq9pTp/Grz/////+fn593d3cfHx7GxsYaGhv///wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA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QZ2CXKmQbryqkZJ7YY14boRtbP///8fHx5eXl5OTk4mJiYODg3Z2dnBwcGlpaWBgYP///wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAEAADYALAAAAAANABAAAAZyQJtwSCyOQiRRKBVamVpCgkBAQqkCJ4DJJRwUSp2SpwQqsWbdR2ft4YAy5+5i3Wm/47YBo3PpW+5oeQl0dnCBAxB8fRcWLHgDDYRuhl0Hin6OhwiSgF0KfBaFjw5rHxobExQVMEMGERIYNTQyMS9Ft0RBADs=';
  34. $imgs['dots']='R0lGODlhAwABAJEAAAAAAP///2RkZP///yH5BAEAAAMALAAAAAADAAEAAAIC1FYAOw==';
  35. if(isset($imgs[$i]))$d=&$imgs[$i];else$d=&$imgs['<x>'];
  36. header('Content-type: image/gif');header('Content-Disposition: attachment; filename="'.$i.'"');print base64_decode($d);
  37. }
  38. else
  39. {
  40. ob_start('ob_gzhandler');
  41. if(!$incl)print'<html><head><style type="text/css">'.$css.'</style></head><body>';
  42. $sb=isset($_GET['s'])?$_GET['s']:0;
  43. $so=isset($_GET['o'])?$_GET['o']:'asc';
  44. $st=$sb==='s'||$sb==='m'?SORT_NUMERIC:SORT_STRING;
  45. $d=isset($_GET['d'])?urldecode($_GET['d']):'';
  46. $d=$d!==''&&$d!=='/'?trim($d,'/').'/':'';
  47. $p=$root.$d;
  48. $h=@opendir($p);
  49. if(strstr($d,'../'))exit('Denied');
  50. if(!$h)exit('Unable to open "'.$d.'". <a href="'.$burl.'">Go home.</a>');
  51. $F=array();$D=array();
  52. while(FALSE!==($f=readdir($h)))if($f[0]!=='.')if(is_dir($p.$f))$D[]=array('n'=>$f,'m'=>filemtime($p.$f),'s'=>filesize($p.$f),'t'=>'Directory');else$F[]=array('n'=>$f,'m'=>filemtime($p.$f),'t'=>e($f),'s'=>filesize($p.$f));
  53. if($sb){$F=s($F,$sb,$so,$st);$D=s($D,$sb,$so,$st);}
  54. print '<table class="itable" cellspacing="2"><tr><td colspan="5">';
  55. print ($d!=='')?"<a href=\"$burl\"><strong>$name</strong></a> / ":"<strong>$name</strong> ";
  56. if($d!==''){$t=explode('/',trim($d,'/'));for($i=0,$r=array(),$z='';($r[]=@$t[$i]),$z=@$t[$i];$i++) { print(implode('/',$r)!==trim($d,'/'))? ('<a href="'.$burl.'d='.implode('%2F',$r).'"><strong>'.$z.'</strong></a> / ' ):"<strong>$z</strong>";}}
  57. $f=trim($d,'/');
  58. print '</td></tr><tr><td class="irows">&nbsp;</td>'
  59. .'<td class="irows"><a href="'.$burl.'s=n&amp;o='.($so=='asc'?'dsc':'asc').'&amp;d='.urlencode($f).'">Name</a></td>'
  60. .'<td class="irows"><a href="'.$burl.'s=s&amp;o='.($so=='asc'?'dsc':'asc').'&amp;d='.urlencode($f).'">Size</a></td>'
  61. .'<td class="irows"><a href="'.$burl.'s=t&amp;o='.($so=='asc'?'dsc':'asc').'&amp;d='.urlencode($f).'">Type</a></td>'
  62. .'<td class="irows" nowrap="nowrap"><a href="'.$burl.'s=m&amp;o='.($so=='asc'?'dsc':'asc').'&amp;d='.urlencode($f).'">Modified</a></td>';
  63. for($i=0,$c='';($c=@$D[$i++]);){print '<tr><td><img src="'.$surl.'?i=dir" alt="'.$c['n'].'"/></td><td><a href="'.$burl.'d='.urlencode($d.$c['n']).'">'.$c['n'].'</td><td>&nbsp;</td><td>&nbsp;</td><td>'.date('m/d/Y h:i A',$c['m']).'</td></tr>';}
  64. for($i=0,$c='';($c=@$F[$i++]);){print '<tr><td><img src="'.$surl.'?i='.$c['t'].'" alt="'.$c['n'].'"/></td><td><a href="'.$rurl.$d.$c['n'].'">'.$c['n'].'</td><td>'.number_format($c['s']/1024,1).'KB</td><td>'.$c['t'].'</td><td>'.date('m/d/Y h:i A',$c['m']).'</td></tr>';}
  65. print '<tr><td colspan="5" class="irows" style="text-align:center;background-position:top;">Directory indexer by <a href="http://celerondude.com">CeleronDude</a></td></tr></table>';
  66. if(!$incl)print'</body></html>';
  67. }
  68. ?>
Download code! Download code (.txt)

 Bekijk een voorbeeld van dit script!
 Stemmen
Niet ingelogd.

 Reacties
Post een reactie
Lees de reacties (1)
© 2002-2024 Sitemasters.be - Regels - Laadtijd: 0.041s