<?php
session_start();
include_once "head.php";
include_once "conf_ini.php";

$f = trim(htmlspecialchars($_GET['f']));
$page=intval($_GET['page']);
if(file_exists($f))
{
   $ex = pathinfo($f);
   //$name = strtolower($ex['filename']);
   $ext=$ex['extension'];
   if($ext=='nth')
   {
   $name = strtolower($ex['basename']);
     echo"<div class=\"verh\">";
     echo $logo."<br />";
     echo"</div>";
     echo"<div class=\"mdlc\"><span class=\"verh2\">";
     echo $name;
     echo"</span></div>";
     echo"<div class=\"telo\">";
     $prewie = '<img src="thema.php?f='.$f.'" alt="screen" /><br />';
     echo $prewie;
       $file_size=filesize($f);
  if ($file_size < 1024) $file_size = $file_size."b";
  if ($file_size >= 1024) $file_size = round (($file_size/1024), 1)."Kb";
  if ($file_size >= 1024) $file_size = round (($file_size/1024), 1)."Mb";
     echo'<a href="'.$f.'">скачать</a>('.$file_size.')<br />';
     echo"</div>";
     }
     else
     {
     	die("ошибка!");
     }
}
else
{
	die("ошибка");
}
   echo"<div class=\"foot2\">";
    echo'<a href="temy.php?page='.$page.'">к темам</a><br />';
    echo'<a href="index.php">создать тему</a><br />';
    echo"</div>";
    echo"<div class=\"foot2\">";
    echo'<a href="'.$gl_site.'">'.$logo.'</a><br />';
    echo"</div>";
    echo"<div class=\"foot\">";
    echo $schetchik;
    echo"</div>";
 echo'</body></html>';

?>
