Просмотр файла sea/apanel_index.php

Размер файла: 11.06Kb
<?
#-----------------------------------------------------#
#     ============ЗАГРУЗ-ЦЕНТР=============           #
#             	 Автор  :  Sea                   	  #
#               E-mail  :  [email protected]              #
#                  ICQ  :  355152215                   #
#   Вы не имеете права распространять данный скрипт.  #
#   		По всем вопросам пишите в ICQ.            #
#-----------------------------------------------------#
list($msec,$sec)=explode(chr(32),microtime());
$HeadTime=$sec+$msec;
include 'moduls/ini.php';
session_name ('SID') ;
session_start();
include 'moduls/fun.php';
include 'moduls/connect.php';
include 'moduls/header.php';
//------------------------------------------------------------------------------------------
$error = 0;
if(empty($_SESSION['autorise'])) $error = 1;
if($_SESSION['autorise']!= $setup['password']) $error = 1;
if(empty($_SESSION['ipu'])) $error = 1;
if($_SESSION['ipu']!=clean($ip))  $error = 1;
if($error==1) die($setup['hackmess']);
//------------------------------------------------------------------------------------------
$onpage = get2ses('onpage');
$sort   = get2ses('sort');
is_num($id,'id');
is_num($onpage,'onpage');
is_num($page,'page');
//------------------------------------------------------------------------------------------
if(!$id) $d['path'] = $setup['path']."/"; else $d = mysql_fetch_array(mysql_query("SELECT `path` FROM `files` WHERE `id` = '".$id."'"));
if (!is_dir ($d['path'])) die("Такой категории не существует!");
//------------------------------------------------------------------------------------------
$all = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM `files` WHERE `infolder` = '".$d['path']."'"));
$all = $all[0];
$pages = ceil($all/$onpage);
if(!$pages) $pages = 1;
if($page>$pages or $page<=0) $page=1;
if($start>$all or $start<=0) $start = 0;
if($page) $start = ($page - 1) * $onpage; else $start = 0;
//------------------------------------------------------------------------------------------
$valid_sort = array('name' => '','data' => '','load' => '','size' => '','eval' =>'');
if(!isset($valid_sort[$sort]) )  die($hackmess);
if($sort == 'name') $MODE = '`priority` DESC,`name` ASC';
if($sort == 'data') $MODE = '`priority` DESC,`timeupload` DESC';
if($sort == 'size') $MODE = '`priority` DESC,`size` ASC';
if($sort == 'load') $MODE = '`priority` DESC,`loads` DESC';
if($sort == 'eval' and $setup['eval_change']==1) $MODE = '`priority` DESC,`yes` DESC ,`no` ASC';
//------------------------------------------------------------------------------------------
$query = mysql_query("SELECT `id` FROM `files` WHERE `infolder` = '".$d['path']."' ORDER BY $MODE LIMIT ".$start.", ".$onpage."");
while($list_sw = mysql_fetch_array($query)) $array_id[] = $list_sw['id'];
//------------------------------------------------------------------------------------------
$ex=explode("/",$d['path']);
foreach($ex as $k=>$v)
{
	if ($v!="" and $v!="." and $v!=".." and $v!=$setup['path'] )
		{
		$s = mysql_fetch_array(mysql_query("SELECT `id`,`name` FROM `files` WHERE `path` LIKE '%".clean($v)."/' AND `size` = '0'"));
		$s['name'] = str_replace("*","",$s['name']);
		if($k >= count($ex)-2) $put .= $s['name'];
  		else $put .= "<a href='index.php?id=".$s['id']."'>".$s['name']."</a>&raquo;";
		}
}
echo " <div class=\"mblock\"><a href='apanel_index.php'>Загрузки</a>&raquo;$put</div><div class=\"iblock\">";
//------------------------------------------------------------------------------------------
if($setup['eval_change']==1) $eval = ",<a href='apanel_index.php?sort=eval'>рейтинг</a>"; else $eval="";
if ($sort == 'name') $sortlink = "<a href='apanel_index.php?sort=data'>дата</a>,<a href='apanel_index.php?sort=size'>размер</a>,<a href='apanel_index.php?sort=load'>популярность</a>$eval";
if ($sort == 'data') $sortlink = "<a href='apanel_index.php?sort=name'>имя</a>,<a href='apanel_index.php?sort=size'>размер</a>,<a href='apanel_index.php?sort=load'>популярность</a>$eval";
if ($sort == 'size') $sortlink = "<a href='apanel_index.php?sort=data'>дата</a>,<a href='apanel_index.php?sort=name'>имя,<a href='apanel_index.php?sort=load'>популярность</a></a>$eval";
if ($sort == 'load') $sortlink = "<a href='apanel_index.php?sort=data'>дата</a>,<a href='apanel_index.php?sort=name'>имя,<a href='apanel_index.php?sort=size'>размер</a>$eval";
if ($sort == 'eval' and $setup['eval_change']==1) $sortlink = "<a href='apanel_index.php?sort=data'>дата</a>,<a href='apanel_index.php?sort=name'>имя,<a href='apanel_index.php?sort=size'>размер</a>,<a href='apanel_index.php?sort=load'>популярность</a>";

echo "Сортировать по:<br>$sortlink";
echo"<br><a href='apanel.php?id=$id&amp;action=newdir'>Новая папка</a>";
echo"</div>";
//------------------------------------------------------------------------------------------
if ($all == 0) echo "<b>[Раздел пуст]</b>";
foreach ($array_id as $key => $value)
{
	if(is_integer($key / 2)) $row = "<div class='mainzag'>"; else $row = "<div class='row'>";
	$file_info = mysql_fetch_array(mysql_query("SELECT `id`,`name`,`path`,`fastabout`,`timeupload`,`infolder`,`size` FROM `files` WHERE `id` = '".$value."'"));
	if (is_dir($file_info['path']))
	{
	    echo $row;
	    $allinfolder = mysql_fetch_array(mysql_query('SELECT COUNT(*) FROM `files` WHERE `infolder` LIKE  "'.$file_info['path'].'%" AND `size` > "0";'));
	    $allinfolder = $allinfolder[0];
	    $file_info['name'] = str_replace("*","",$file_info['name']);
		if(!file_exists($file_info['path'].'folder.png'))
		{
			$ico = '<img src="ext/dir.png" alt="">';
			$addico = "[<a href='apanel.php?action=addico&amp;id=".$file_info['id']."'><font color='#761DE2'>+I</font></a>]";
		}
		else
		{
			$ico = "<img src='".$file_info['path']."folder.png' alt=''>";
			$addico = "[<a href='apanel.php?action=reico&amp;id=".$file_info['id']."'><font color='#BF00BF'>-I</font></a>]";
		}
		$updown = '[<a href="apanel.php?id='.$file_info['id'].'&amp;action=pos&amp;to=up"><font color="#008080">Up</font></a>][<a href="apanel.php?id='.$file_info['id'].'&amp;action=pos&amp;to=down"><font color="#008080">Down</font></a>]';
		if($setup['delete_dir']==1) $dl = "[<a href='apanel.php?action=redir&amp;id=".$file_info['id']."'><font color='#B90000'>D</font></a>]"; else $dl = "";
		echo $ico."<a href='apanel_index.php?id=".$file_info['id']."'><b>".$file_info['name']."</b></a>(".$allinfolder.")[<a href='apanel.php?id=".$file_info['id']."&amp;action=flash'><font color='#0080FF'>F</font></a>][<a href='apanel.php?id=".$file_info['id']."&amp;action=rename'><font color='#008080'>R</font></a>][<a href='apanel.php?id=".$file_info['id']."&amp;action=fast'><font color='#000080'>Fast</font></a>]$dl$addico$updown";
        if(!empty($file_info['fastabout'])) echo '<br>'.str_replace("\n", "<br>",$file_info['fastabout']);
        echo '</div>';
	}
	elseif(is_file($file_info['path']))
	{
	    $ex = pathinfo($file_info['path']);
		$ext = strtolower($ex['extension']);
		$filename = $ex['basename'];
		if($file_info['size'] < 1024) $file_info['size'] = "(".$file_info['size']."b)";
		if($file_info['size'] < 1048576 and $file_info['size'] >= 1024) $file_info['size'] = "(".round($file_info['size']/1024, 2)."Kb)";
		if($file_info['size'] > 1048576) $file_info['size'] = "(".round($file_info['size']/1024/1024, 2)."Mb)";

        if(!file_exists("ext/$ext.png")) $ico = "<img src='ext/stand.png' alt=''>"; else $ico = "<img src='ext/$ext.png' alt=''>";

   		$file_info['timeupload'] = date("d.m.Y (H:i)", $file_info['timeupload']);

   		if($setup['ext']==1) $extension = "($ext)"; else $extension = "";

   		if($setup['delete_file']==1) $dl = "[<a href='apanel.php?action=refile&amp;id=".$file_info['id']."'><font color='#B90000'>D</font></a>]"; else $dl = "";

   		if($ext=='zip') $unzip = "[<a href='apanel.php?id=$file_info[id]&amp;action=unpack'><font color='#FFFF00'>U</font></a>]"; else $unzip = "";

		if(!is_file($setup['spath']."/".$filename.".gif")) $add_screen = '+S'; else $add_screen = '-S';
		$screen = '[<a href="apanel.php?id='.$file_info['id'].'&amp;action=screen"><font color="#FFFF00">'.$add_screen.'</font></a>]';
        echo $row;

		echo "".$ico."<a href='apanel_view.php?id=".$file_info['id']."'><b>".$file_info['name']."</b></a>$extension".$file_info['size']."[<a href='apanel.php?id=".$file_info['id']."&amp;action=rename'><font color='#008080'>R</font></a>][<a href='apanel.php?id=".$file_info['id']."&amp;action=editabout'><font color='#800080'>O</font></a>][<a href='apanel.php?id=".$file_info['id']."&amp;action=fast'><font color='#000080'>Fast</font></a>]".$unzip.$dl.$screen;
		if(!empty($file_info['fastabout'])) echo '<br>'.str_replace("\n", "<br>",$file_info['fastabout']);
		if ($sort=="data") echo "<br>Добавлен: ".$file_info['timeupload']."";
    	if ($sort=="load") echo "<br>Скачано ".$file_info['loads']." раз(а)";
    	if ($sort=="eval" and $setup['eval_change']==1) echo "<br>Рейтинг(+/-): $file_info[yes]/$file_info[no]<br>";
    	echo '</div>';
    }
}
//------------------------------------------------------------------------------------------
echo "</div><div class=iblock>Страницы: ";
$asd= $page - 2;
$asd2= $page + 3;
if($asd<$all && $asd>0 && $page>3) echo "<a href=\"apanel_index.php?id=$id&amp;page=1\">1</a> ... ";
for($i=$asd; $i<$asd2;$i++)
	{
		if($i<$all && $i>0)
			{
				if ($i > $pages )  break;
				if ($page==$i) 	echo "<b>[$i]</b> ";
                else echo "<a href=\"apanel_index.php?id=".$id."&amp;page=$i\">$i</a> ";
            }
	}

if ($i <= $pages)
{
	if($asd2<$all) echo " ... <a href=\"apanel_index.php?id=$id&amp;page=$pages\">$pages</a>";
}
echo "<br/>";
//------------------------------------------------------------------------------------------
if ($pages>$setup['pagehand'] and $setup['pagehand_change'] == 1)
{
 	echo "Страница $page из $pages:<br/>";
 	echo '<form action="apanel_index.php?id='.$id.'" method="post">';
 	echo '<input class=enter name="page" type="text" maxlength="4" size="8" value="">';
 	echo '&nbsp;<input class=buttom type="submit" value="Перейти">';
 	echo '</form>';
}
//------------------------------------------------------------------------------------------
if($setup['onpage_change'] == 1)
{
 	echo 'Файлов на страницу: ';
	for($i=10; $i<35;$i=$i+5)
 	{
  		if ($i==$onpage) echo "<b>[$i]</b>";
  		else echo "[<a href=\"apanel_index.php?onpage=$i&amp;id=$id\">$i</a>]";
 	}
 	echo "<br/>";
}
//------------------------------------------------------------------------------------------
echo "</div><div class=iblock>";
//------------------------------------------------------------------------------------------
echo '
- <a href="apanel.php">Админка</a></div>';
list($msec,$sec)=explode(chr(32),microtime());
echo '<hr noshade size=1 class=hr>'.round(($sec+$msec)-$HeadTime,4).' сек.<br>&copy;[Sea][2007]</body></html>';

?>