Просмотр файла bib/primer/index.php

Размер файла: 3.61Kb
<?php
Error_Reporting(E_ALL & ~E_NOTICE);


////// скрипт скачен с сайта WAP.LEXOS.RU

$tranc = 1;  // поменяй на 0 если не хочишь использовать встроенный перекодировщик
$five = 800; // число символов на странице
$dir = './book/';  //папка с текстов. файлами, ВСЕ ФАЙЛЫ ОБЯЗАТЕЛЬНО С РАСШИРЕНИЕМ .txt
$tranc = 1;  // поменяй на 0 если не хочишь использовать встроенный перекодировщик
Error_Reporting(E_ALL & ~E_NOTICE);
$echo = '<!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.0//EN"
"http://www.wapforum.org/DTD/xhtml-mobile10.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">';
print '<html xmlns="http://www.w3.org/1999/xhtml">
<link href="style.css" rel="stylesheet" type="text/css">
<head>
<title>WAP.LEXOS.RU</title>
<STYLE type="text/css"></STYLE>
</head><body>
<p align=\"center\"><hr>';




$open_dir=opendir($dir);
while (false!==($file=readdir($open_dir)))
{
if (is_file("$dir/$file")) {$f[]=$file;}
}
closedir($open_dir);

if(!isset($_GET['id']))
{
foreach($f as $d)
$echo .= '<p align="left"><a href="index.php?id='.substr($d,0,-4).'">'.substr($d,0,-4).'</a><br/>';
}

else
{

$id = $_GET['id'];
$file_name = $dir.$_GET['id'].'.txt';
if (!in_array ($id.'.txt',$f)) { header("Location: index.php"); }
else
{
if(!isset($_GET['p']))$p=1; else $p = $_GET['p'];
$file= join('',file($file_name));
$obsum = $p * $five;
$nasum = $obsum - $five;
$end='0';

if(!isset($_GET['go']))
{
for($i=$nasum; $i<$obsum; $i++)
{
if(!isset($file[$i])) {$end='1';} else {$echo .=htmlspecialchars($file[$i]);}
}

$echo .= '<hr>';

if($p == '1')  $echo .= ''; else {$echo .= '<a href="index.php?id='.$id.'&amp;p='.($p-1).'">назад</a>';$echo .= ' '; }
if($end=='1')  $echo .= ''; else {$echo .= '<a href="index.php?id='.$id.'&amp;p='.($p+1).'">далее</a>';}

$echo .= '<br/><a href="index.php">в начало</a>';
}

else $echo .='
введите номер страницы от 1 до '.(ceil(strlen($file)/$five)).'<br/><input name="code" format="*N" maxlength="10" title="code"/>
<anchor title="go">перейти<go href="index.php" method="get">
<postfield name="p" value="$(code)"/>
<postfield name="id" value="'.$id.'"/>
</go></anchor><br/><a href="index.php">в начало</a>';

}
}









$echo .= '<br/><a href="http://lexos.ru/bib/index.php">&#x412; &#x431;&#x438;&#x431;&#x43B;&#x438;&#x43E;&#x442;&#x435;&#x43A;&#x443;</a></p>';

function unicode($string)
{
$rus=array('А','Б','В','Г','Д','Е','Ж','З','И','Й','К','Л','М','Н','О','П','Р','С','Т','У','Ф','Х','Ц','Ч','Ш','Щ','Ъ','Ы','Ь','Э','Ю','Я',
           'а','б','в','г','д','е','ж','з','и','й','к','л','м','н','о','п','р','с','т','у','ф','х','ц','ч','ш','щ','ъ','ы','ь','э','ю','я');
$string = str_replace('Ё','&#1025;',$string);
$string = str_replace('ё','&#1105;',$string);
for($i=0; $i<count($rus); $i++)
{
$s=1040;
$d = '&#'.($s+$i).';';
$string = str_replace($rus[$i],$d,$string);
}
return $string;
}

if($tranc==0) echo $echo; else echo unicode($echo);

echo '
<p align="center">
<div class="over"><a href="http://lexos.ru/">WAP.LEXOS.RU</a></div>
<br/>
<img src="http://wap-top.ru/top/count.php?uid=3663 " alt="online " /></a><br /><a href="http://waplog.net/ru/c.shtml?26564"><img src="http://c.waplog.net/ru/26564.cnt" alt="waplog" /></a><br/>
..<br/>
created by Lexx</a>
</p>
</body>
</html>';




?>