Размер файла: 1.49Kb
- <?php
- require('require/configuration.php');
- require('require/head.php');
- if(!empty($_GET['txt'])){
- $path=base64_decode($_GET['txt']);
- }
- if(!is_file($path)||strpos($path,'..')!==FALSE||$path{0}=='/'||strtolower(substr($path,strrpos($path,'.')+1))!='txt'){
- echo'
- <div class="mid_menu"></div>
- <div class="contents"><span class="b">Помилка відкриття файла</span>
- </div>
- <div class="mid_menufoot"></div>';
- require('require/foot.php');
- exit;}
- if(!empty($_GET['p'])){
- $p=intval(abs($_GET['p']));
- }else{
- $p=1;
- }
- define('PATH',$path);
- require('require/functions.php');
- $file=file(PATH);
- $name=$file[0];
- unset($file[0]);
- $file=explode('. ',implode(NULL,$file));
- $c=count($file);
- $file=array_slice($file, ($p-1)*$rec, $rec);
- file_lib_path($name);
- echo'<div class="mid_menu"></div>
- <div class="contents">'.my_filter(implode('. ',$file)).'</div>
- <div class="mid_menufoot"></div>
- ';
- if(ceil($c/$rec)>1){
- echo'<div class="foot_menu"></div>
- <div class="contents">Сторінки: ';
- $prev=$p-2;
- $next=$p+3;
- $stall=ceil($c/$rec);
- if($prev<$c&&$prev>1){echo'<a href="read.php?p=1&txt='.$_GET['txt'].'">1</a> ... ';}
-
- for($i=$prev;$i<$next;)
- {
- if($i<=$stall&&$i>=1){
- if($p==$i){echo'<span class="b">['.$i.']</span>';}else{echo' <a href="read.php?p='.($i).'&txt='.$_GET['txt'].'">'.$i.'</a> ';}
- }
- $i++;}
- if($next<=$stall){echo ' ... <a href="read.php?p='.$stall.'&txt='.$_GET['txt'].'">'.$stall.'</a>';}
- echo'</div>
- <div class="foot_menufoot"></div>';
- }
- require('require/foot.php');
- ?>