File size: 2.34Kb
<?php
include 'constant.php';
@$read = strip_tags(trim($_GET["read"]));
@$br = $_GET["br"];
if($read) {
$er = strrchr($read,'.');
if(preg_match("[http]",$read)) exit(ERROR_MESAGE);
if(preg_match("[www]",$read)) exit(ERROR_MESAGE);
if(preg_match("[:]",$read)) exit(ERROR_MESAGE);
if(preg_match("[%]",$read)) exit(ERROR_MESAGE);
if(preg_match("[ ]",$read)) exit(ERROR_MESAGE);
if(preg_match("[//]",$read)) exit(ERROR_MESAGE);
if($er != '.txt') exit(ERROR_MESAGE);
$text = @file($read); @$st = strip_tags(trim($_GET["st"]));
if(empty($st)) {
$st = 0;
}
$fn = $st + READ_COUNT;
if($read = preg_match("[\.d.txt]",$read)) {
for($i=$st;$i<$fn;$i++) {
echo highlight_string($text[$i],true);
}
echo '<br />';
if($st != 0) {
echo '<small><a href="?st='.($st-READ_COUNT).'&read='.$_GET["read"].'&br='.str_replace('..','',$br).'"><<Назад</a></small> |';
}
if($fn < sizeof($text)) {
echo ' <small><a href="?st='.($st+READ_COUNT).'&read='.$_GET["read"].'&br='.str_replace('..','',$br).'">Далее>></a></small>';
}
} elseif($read == preg_match("[\.a\.txt]",$read)) {
for($i=$st;$i<$fn;$i++) {
echo '<small>'.strip_tags($text[$i],'<a>').'</small>';
}
echo '<br />';
if($st != 0) {
echo '<small><a href="?st='.($st-READ_COUNT).'&read='.$_GET["read"].'&br='.str_replace('..','',$br).'"><<Назад</a></small> |';
}
if($fn < sizeof($text)) {
echo ' <small><a href="?st='.($st+READ_COUNT).'&read='.$_GET["read"].'&br='.str_replace('..','',$br).'">Далее>></a></small>';
}
} else {
for($i=$st;$i<$fn;$i++) {
echo '<small>'.htmlspecialchars($text[$i],true).'</small>';
}
echo '<br />';
if($st != 0) {
echo '<small><a href="?st='.($st-READ_COUNT).'&read='.$_GET["read"].'&br='.str_replace('..','',$br).'"><<Назад</a></small> |';
}
if($fn < sizeof($text)) {
echo ' <small><a href="?st='.($st+READ_COUNT).'&read='.$_GET["read"].'&br='.str_replace('..','',$br).'">Далее>></a></small>';
}
}
echo '<hr><small>
<a href="'.$_GET["read"].'">Сохранить в txt</a>
<br />
<a href="index.php?a='.str_replace('..','',$br).'">К разделам</a></small>';
include("./lite/footer.inc.php");
exit();
}
?>