View file manager.php

File size: 1.89Kb
<?php
require('includes/header.php');
require('includes/utils.php');
require('includes/db.php');
require('includes/auth.php');

$max_files = 5;

if(isset($_GET['from']))
   $from = $_GET['from'];
else
   $from = 0;

$to = $from + $max_files;
?>
<wml>
<head><meta http-equiv="Cache-Control" content="no-cache" forua="true"/></head>
<card id="manager" title="&#x041C;&#x0435;&#x043D;&#x0435;&#x0434;&#x0436;&#x0435;&#x0440; &#x0444;&#x0430;&#x0439;&#x043B;&#x043E;&#x0432;">
<do type="options" name="main" label="&#x041C;&#x0435;&#x043D;&#x044E;"><go href="main.php?id=<?php echo $id; ?>&amp;p=<?php echo $login; ?>"/></do>
<p>
<?php
   $n = 0;
   $files = '';
   if ($handle = opendir("$login/"))
   {
      while (false !== ($file = readdir($handle)))
      {
         if($file != '.' && $file != '..' && $file != 'files')
         {
            $filesize = filesize("$login/$file");
            if($n >= $from && $n < $to)
               $files .= '<a href="pageview.php?id=' . $id . '&amp;p=' . $login . '&amp;page=' . $file . '">' . $file . '(' . $filesize . ' byte)</a><br/>';
            $n++;
         }
      }
      closedir($handle);
   }

if($n > $to )
         $files .= <<<FILEDATA
<a href="manager.php?id=$id&amp;p=$login&amp;from=$to">Далее</a>
<br/>
FILEDATA;

$back_from = $from - $max_files;
if($from > 0)
   $files .= <<<FILEDATA
<a href="manager.php?id=$id&amp;p=$login&amp;from=$back_from">Назад</a>
<br/>
FILEDATA;

?>
&#x0412;&#x0441;&#x0435;&#x0433;&#x043E; &#x0444;&#x0430;&#x0439;&#x043B;&#x043E;&#x0432;:<?php echo $n; ?>
<br/>
<?php echo $files; ?>
</p>
<p align="center">
*********<br/>
<a href="edittitle.php?id=<?php echo $id; ?>&amp;p=<?php echo $login; ?>&amp;page=index.wml&amp;cp=go">Добавить страницу</a><br/>
<a href="main.php?id=<?php echo $id; ?>&amp;p=<?php echo $login; ?>">Меню</a><br/>
</p>
</card>
</wml>