Advertisement
Sonic3R

Untitled

Aug 4th, 2011
191
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 3.91 KB | None | 0 0
  1. <?php
  2. function fsize($file) {
  3.  
  4.   $fmod = filesize($file);
  5.   if ($fmod < 0) $fmod += 2.0 * (PHP_INT_MAX + 1);
  6.   $i = 0;
  7.  
  8.   $myfile = fopen($file, "r");
  9.   while (strlen(fread($myfile, 1)) === 1) {
  10.     fseek($myfile, PHP_INT_MAX, SEEK_CUR);
  11.     $i++;
  12.   }
  13.  
  14.   fclose($myfile);
  15.   if ($i % 2 == 1) $i--;
  16.   return ((float)($i) * (PHP_INT_MAX + 1)) + $fmod;
  17. }
  18.  
  19. if ($handle = opendir('diskuser/Sonic3R'))   //aici pun public in loc de Sonic3R si alte alea
  20. {
  21.     $path="images/files/nou/";
  22.     $imagine="";
  23.   while (false !== ($file = readdir($handle))) {
  24.         //echo "$file\n";
  25.          if ($file != "." && $file != "..")
  26.             {
  27.         $file = strtolower($file) ;
  28.         $exts = explode(".", $file) ;
  29.          $n = count($exts)-1;
  30.         $exts = $exts[$n];
  31.         //echo $exts;
  32. switch($exts)
  33.     {
  34. case "php":{$imagine=$path."php.png";break;}
  35. case "html":{$imagine=$path."html.png";break;}
  36. case "js":{$imagine=$path."js.png";break;}
  37. case "air":{$imagine=$path."air.png";break;}
  38. case "asp":{$imagine=$path."asp.png";break;}
  39. case "h":{$imagine=$path."header_c++.png";break;}
  40. case "c":{$imagine=$path."c.png";break;}
  41. case "cpp":{$imagine=$path."c++.png";break;}
  42. case "cs":{$imagine=$path."csharp.png";break;}
  43. case "css":{$imagine=$path."css.png";break;}
  44. case "as":{$imagine=$path."as.png";break;}
  45. case "fla":{$imagine=$path."flash.png";break;}
  46. case "flv":{$imagine=$path."flash.png";break;}
  47. case "fs":{$imagine=$path."fsharp.png";break;}
  48. case "vjp":{$imagine=$path."j++.png";break;}
  49. case "class":{$imagine=$path."class.png";break;}
  50. case "java":{$imagine=$path."java.png";break;}
  51. case "jsp":{$imagine=$path."jsp.png";break;}
  52. case "pas":{$imagine=$path."pascal.png";break;}
  53. case "pl":{$imagine=$path."perl.png";break;}
  54. case "psd":{$imagine=$path."psd.png";break;}
  55. case "py":{$imagine=$path."python.png";break;}
  56. case "rb":{$imagine=$path."ruby.png";break;}
  57. case "sql":{$imagine=$path."sql.png";break;}
  58. case "swf":{$imagine=$path."swf.png";break;}
  59. case "xml":{$imagine=$path."xml.png";break;}
  60. case "apk":{$imagine=$path."android.png";break;}
  61. case "dmg":{$imagine=$path."ios.png";break;}
  62. case "7z":{$imagine=$path."7z.png";break;}
  63. case "arj":{$imagine=$path."arj.png";break;}
  64. case "bz2":{$imagine=$path."bz2.png";break;}
  65. case "gz":{$imagine=$path."gz.png";break;}
  66. case "rar":{$imagine=$path."rar.png";break;}
  67. case "sit":{$imagine=$path."sit.png";break;}
  68. case "tar":{$imagine=$path."tar.png";break;}
  69. case "zip":{$imagine=$path."7z.png";break;}
  70. case "pdf":{$imagine=$path."pdf.png";break;}
  71. case "xls":{$imagine=$path."excel.png";break;}
  72. case "xlsx":{$imagine=$path."excel.png";break;}
  73. case "pst":
  74. case "ost":
  75. case "pab":
  76. case "oab":
  77. case "msg":{$imagine=$path."outlook.png";break;}
  78. case "ppt":
  79. case "pptx":{$imagine=$path."powerpoint.png";break;}
  80. case "pub":{$imagine=$path."publisher.png";break;}
  81. case "doc":
  82. case "docx":{$imagine=$path."word.png";break;}
  83. case "adp":
  84. case "adp":
  85. case "accdp":
  86. case "accdr":
  87. case "mdb":
  88. case "mda":
  89. case "mdf":
  90. case "mde":
  91. case "accde":
  92. case "mam":
  93. case "maq":
  94. case "mar":
  95. case "mat":
  96. case "maf":
  97. case "ade":{$imagine=$path."access.png";break;}
  98. case "grv":{$imagine=$path."groove.png";break;}
  99. case "xsn":{$imagine=$path."infopath.png";break;}
  100. case "one":{$imagine=$path."onenote.png";break;}
  101. case "csv":{$imagine=$path."csv.png";break;}
  102. case "png":{$imagine=$path."png.png";break;}
  103. case "tiff":{$imagine=$path."tiff.png";break;}
  104. case "gif":{$imagine=$path."gif.png";break;}
  105. case "jpg":{$imagine=$path."jpg.png";break;}
  106. case "jpeg":{$imagine=$path."jpg.png";break;}
  107. case "inf":{$imagine=$path."inf.png";break;}
  108. case "bat":{$imagine=$path."bat.png";break;}
  109.  
  110. default:{$imagine=$path."others.png";break;}
  111.     }
  112.     $marime=fsize($file);
  113.    
  114.     //echo $file." <img src='".$imagine."' width='80' height='80'/>";
  115.     echo "<div class='file'><img src='".$imagine."' width='55' height='55'/><br/>".$file."<p class='info' style='display:none'>".$marime."</p></div>";
  116.             }
  117.     }
  118.    
  119.    
  120.  
  121.     closedir($handle);
  122.  
  123. }
  124. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement