Advertisement
Guest User

Untitled

a guest
Aug 1st, 2015
222
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 3.44 KB | None | 0 0
  1. <html>
  2. <head>
  3. <meta http-equiv="Content-Language" content="en">
  4. <title>HLTV Demos</title>
  5. </head>
  6. <body bgcolor="#151515">
  7. <div align="center"><a href="./" style="color: #FCAA21; font-size: 22px;">Evil Soldiers Clan Demo Archive</a>
  8.     <p style="color: #FFFFFF;">
  9. <?php
  10.  
  11. function human_filesize($bytes, $decimals = 2) {
  12.   $sz = 'BKMGTP';
  13.   $factor = floor((strlen($bytes) - 1) / 3);
  14.   return sprintf("%.{$decimals}f", $bytes / pow(1024, $factor)) . @$sz[$factor];
  15. }
  16.  
  17. if ($handle = opendir('c:/xampp/htdocs/esclan.net/hltv/')) { // dir with .zip files
  18. echo "<table cellspacing = '2' width = '500' bgcolor = '#333333' style = 'text-align: center;'>
  19.     ";
  20.    
  21. $files = array();
  22. while (false !== ($file = readdir($handle)))
  23. {
  24.     if (strlen($file) > 4)
  25.     {
  26.         /*($line) ? $line-- : $line++;
  27.         $color = ($line) ? '#151515' : '#000000';
  28.         $gabali = explode("-", $file);
  29.         $date = $gabali[1];
  30.         $mape = $gabali[2];
  31.         $mapesgabali = explode(".", $mape);
  32.         $name = $mapesgabali[0];
  33.         $year = substr($date,0,2);
  34.         $month = substr($date,2,2);
  35.         $day = substr($date,4,2);
  36.         $hour = substr($date,6,2);
  37.         $minute = substr($date,8,2);
  38.         $size = filesize("c:/xampp/htdocs/esclan.net/hltv/".$file);
  39.         $goodsize = human_filesize($size);*/
  40.         $files[] = $file;
  41.         /*echo " <tr style='background-color: $color;'>
  42.                  <td>
  43.                  <font color='#FFFFFF' face='Verdana' size='2'>$month/$day/$year $hour:$minute</li>
  44.                  </font></td>
  45.                  <td>
  46.                  <font color='#75B5EA' face='Verdana' size='2'>$name</font></td>
  47.                  <td> <a href='hltv/$file'>
  48.                  <font color='#FCAA21' face='Verdana' size='2'>download ($goodsize bytes)</font></a></td>
  49.               </tr>";*/
  50.     }
  51. }
  52. closedir($handle);
  53. }
  54. $files = array_reverse($files);
  55. $line=1;
  56. $filecount = count($files);
  57. $show = 10;
  58. $page = (int)$_GET['page']?:0; // _GET['page'] or 0 for default
  59. $startcount =$page * $show;
  60. $endcount = $startcount + $show;
  61. $pages = ceil(count($files)/$show);
  62. $shownfiles = 0;
  63. echo "Page $page of $pages <br> $filecount files. <br> Displaying $startcount to $endcount.<br>";
  64. //print_r($filearray);
  65. foreach ($files as $file)
  66. {
  67.     $shownfiles++;
  68.     ($line) ? $line-- : $line++;
  69.     $color = ($line) ? '#151515' : '#000000';
  70.     $gabali = explode("-", $file);
  71.     $date = $gabali[1];
  72.     $mape = $gabali[2];
  73.     $mapesgabali = explode(".", $mape);
  74.     $name = $mapesgabali[0];
  75.     $year = substr($date,0,2);
  76.     $month = substr($date,2,2);
  77.     $day = substr($date,4,2);
  78.     $hour = substr($date,6,2);
  79.     $minute = substr($date,8,2);
  80.     $size = filesize("c:/xampp/htdocs/esclan.net/hltv/".$file);
  81.     $goodsize = human_filesize($size);
  82.    
  83.    
  84.     //$files[] = $file;
  85.    
  86.     //echo "$shownfiles ($startcount <= $shownfiles && $shownfiles <= $endcount)<br>";
  87.     if($startcount <= $shownfiles && $shownfiles <= $endcount)
  88.     //if($shownfiles < $startcount || $shownfiles >= $maxlimit + $limit)
  89.     {
  90.         echo "<tr style='background-color: $color;'>
  91.                     <td>
  92.                     <font color='#FFFFFF' face='Verdana' size='2'>$month/$day/$year $hour:$minute</li>
  93.                     </font></td>
  94.                     <td>
  95.                     <font color='#75B5EA' face='Verdana' size='2'>$name</font></td>
  96.                     <td> <a href='hltv/$file'>
  97.                     <font color='#FCAA21' face='Verdana' size='2'>download ($goodsize bytes)</font></a></td>
  98.                 </tr>";
  99.     }
  100.     //print "<li>$file</li>\n";
  101. }
  102.  
  103.  
  104. echo "</table>";
  105. $pagecounter=0;
  106. while($pagecounter < $pages) {
  107.    
  108.     if($pagecounter == $page) {
  109.         echo "[".$pagecounter."] ";
  110.     } else {
  111.         echo "[<a href='?page=".$pagecounter."'] ";
  112.     }
  113.     $pagecounter++;
  114. }
  115. ?>
  116.  
  117.     </p></div>
  118. </body>
  119. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement