Просмотр файла down/txt.php

Размер файла: 6.24Kb
<?php
#######################################################
#######################################################
###                Загруз-Центр для 7ba_cms         ###
###                 Автор: WapStyle                 ###
###                 Сайт: http://wap.irbit.in       ###
###                e-mail: [email protected]       ###
#######################################################
#######################################################
### Вы НЕ имеете право продовать этот скрипт или    ###
### получать какую-либо выгоду.                     ###
### Вы можете вносить изменения в данный код скрипта###
#######################################################
#######################################################



$mt=microtime(1);
include('setup.php');
include('func.php');
if($zip)
{include('zip.php');}

//Сортировка и предпросмотр:

$p=intval(@$_GET['p']);
$sort=intval(@$_GET['sort']);
if($sort>1 OR $sort<0)
{$sort=0;}

$file=htmlspecialchars($_GET['file']);
$file=str_replace("\0", '', $file);
if(!file_exists($file) or !is_file($file) or r($file)!='txt' or strstr($file,'..')or strstr($file,'http://') or strstr($file,'ftp://'))
$file='';
if($file)
{$dir=str_replace('load/','',dirname($file));}

//ШАПКА
print $top;

if(!$file)
{print 'Файла не существует<br />';}
else
	{
	if(file_exists($file.'.doc'))
		{
		$ds=filesize($file.'.doc');
		if($ds>1024)
		$ds=round($ds/1024,2).' кб';
		else
		$ds.=' б';
		print '<a href="'.$file.'.doc">Скачать в формате .doc('.$ds.')</a><br/>';
		}
		$text=file($file);
		$t=array();
		$n=1;
		$t[1]='';
		$count=count($text);
		$page=intval(@$_GET['page']);
		if(!$page)
		$page=1;

		for($i=0; $i<$count; $i++)
		{
		$t[$n].=$text[$i];
		if(strlen($t[$n])>=4000)
		{$n++; $t[$n]='';}
		}
		if(!trim($t[$n]))
		$n--;
		print nl2br(htmlspecialchars($t[$page]));


		//nav_page($n,$page,'file.php?file='.$file.'&amp;str='.$str.'&amp;p='.$p.'&amp;sort='.$sort.'&amp;page=');
		//Разбивка по страницам
function nav_pagetxt($countstr,$page,$dir,$p,$sort,$main)
{
$list='Страница '.($page+1).' из '.$countstr.'<br />';
		for($i=0; $i<3; $i++)
			{
			if($i>$countstr-1)
			break;
			if($page!=$i)
			$list.='<a href="'.$main.'.php?file='.$dir.'&amp;p='.$p.'&amp;page='.($i+1).'&amp;sort='.$sort.'">'.($i+1).'</a>|';
			else
			$list.=($i+1).'|';
			}
		if($countstr>3)
		{
		$list.='...';

		for($n=$page-3; $n<$page+3; $n++)
			{
			if($n>$countstr-1)
			break;
			if($n<3)
			continue;
			if($page!=$n)
			$list.='<a href="'.$main.'.php?file='.$dir.'&amp;p='.$p.'&amp;page='.($n+1).'&amp;sort='.$sort.'">'.($n+1).'</a>|';
			else
			$list.=($n+1).'|';
			}
		$next=$n;
		}
		if(@$n<$countstr and isset($n))
			{
			$list.='..';
			for($n=$countstr-3; $n<$countstr; $n++)
				{
				if($n<@$next)
				continue;
				if($page!=$n)
				$list.='<a href="'.$main.'.php?file='.$dir.'&amp;p='.$p.'&amp;page='.($n+1).'&amp;sort='.$sort.'">'.($n+1).'</a>|';
				else
				$list.=($n+1).'|';
				}
			}
return $list.'<br />';
}
	if($n)
		print nav_pagetxt($n,$page-1,$file,$p,$sort,'txt');
		$dirkomm=str_replace('/', 'D', str_replace('.', 'T', $file));
		if(!file_exists('komm/'.$dirkomm))
		$countkomm=0;
		else
		$countkomm=count(file('komm/'.$dirkomm));
		print '<a href="komm.php?p='.$p.'&amp;file='.$file.'&amp;sort='.$sort.'">Комментрии['.$countkomm.']</a><br />';
	//Возврат
	if(($countj=count(explode('/',$dir)))>1)
		{
		print '</div><hr/><div>Вернуться:<br />';
		$j=explode('/',$dir);
		for($i=0; $i<=$countj; $i++)
		{
		$u=@$j[count($j)-1];
		if($u)
		{

		$g[$i]= '/<a href="index.php?dir='.join('/', $j).'&amp;p='.$p.'&amp;sort='.$sort.'">'.transdir($u).'</a>';
		unset($j[count($j)-1]);
		}
		}
		for($i=count(@$g)-1; $i>=0; $i--)
		print $g[$i];
		print '<br/>';
		}
	}

echo "</div></div></div>";
///////////////////////Блок онлайна/////////////////////////
	echo "<div style='text-align:center'><div class='contur'>
	<div class='header'>";
$t=mysql_num_rows(mysql_query("select * from `online` where `iduser`='Гость' && `ltime`>'".intval(time()-200)."';"));

echo "Сейчас анонимных: <a href='stat.php?act=guest'>".$t."</a><br/>";
$t=mysql_num_rows(mysql_query("select * from `online` where `iduser`!='Гость' && `ltime`>'".intval(time()-200)."';"));

echo "Сейчас авторизированных: <a href='stat.php?act=reg'>".$t."</a><br/>";
$e=mysql_num_rows(mysql_query("select * from `users`;"));
echo "Всего зарегистрированных: <a href='stat.php?act=all'>".$e."</a>";
echo "</div></div></div>";
/////////////////////////////////////////////////////////////
//////////////////////Личное меню////////////////////////////
 if (!empty($_SESSION['login']))
{
 $newl = mysql_query("select * from `let` where `user` LIKE '".$_SESSION['login']."' and `type` LIKE 'in' and `read` LIKE 'no';");
$countnew = mysql_num_rows($newl);
if ($countnew>0)
{$newletters = "<span style='color: red'>У Вас есть новые личные сообщения: <a href='../let/'>".$countnew."</a> шт.</span><br/>";}
echo "
 <div style='text-align:center;'>
 <div class='contur'>
 <div class='header'>".$newletters ."Вы вошли как <b>".$_SESSION['login']."</b> [<a href='../index.php?act=exit'>Выход</a>]<br/><a href='../my.php'>Меню</a><br/>
 </div>
 </div>
 </div>";
}
else
{echo "<div class='contur'>
 <div class='header'><div style='text-align:center'><b>Вы не авторизированы</b><br/><a href='../in.php'>Авторизация</a><br/><a href='../index.php?act=reg'>Регистрация</a></div> </div>
 </div>";}
/////////////////////////////////////////////////////////////
///////////////////////Низ///////////////////////////////////
echo "<div class='contur_rek'><div class='header_rek'><div style='color:#c00000; text-align:center;'>".$setall['copyright']."</a></div></div></div></body></html>";
ob_end_flush();
/////////////////////////////////////////////////////////////
?>