Просмотр файла admin/file.php

Размер файла: 5.34Kb
<?
#-------------------------------------------#
# Автор скрипта : -=Орёл=- (c)              #
# email         : [email protected]                #  
# icq           : 952-042                   #
# Скрипт распространяется бесплатно:)       #
# Пишу скрипты на заказ обращатся в icq     #                                         
#-------------------------------------------#
include_once("../inc/ini.php");
include_once("../inc/connect.php");
include_once("../inc/function.php");
include_once("../inc/config.php");
include_once("../themes/$config_themes/index.php");

$OR_SES = mysql_query("SELECT * FROM admin WHERE id='$_SESSION[id_admin]' and pass='$_SESSION[pass_admin]'");
if (mysql_num_rows($OR_SES)){

if ($_GET['tid'] == 'sort'){
$sort = htmlspecialchars($_POST['sort']);
if ($sort == '1'){$query = 'id'; $_SESSION['num'] = '1'; $_SESSION['quir']=''; $_SESSION['quir']=$query;}
elseif ($sort == '2'){$query = "format='mp3'||format='wav'||format='mid'||format='amr'"; $_SESSION['num'] = '2'; $_SESSION['quir']=''; $_SESSION['quir']=$query;}
elseif ($sort == '3'){$query = "format='mp4'||format='3gp'||format='avi'"; $_SESSION['num'] = '3'; $_SESSION['quir']=''; $_SESSION['quir']=$query;}
elseif ($sort == '4'){$query = "format='jar'||format='jad'||format='sis'"; $_SESSION['num'] = '4'; $_SESSION['quir']=''; $_SESSION['quir']=$query;}
elseif ($sort == '5'){$query = "format='zip'||format='rar'||format='gz'||format='gzip'"; $_SESSION['num'] = '5'; $_SESSION['quir']=''; $_SESSION['quir']=$query;}
elseif ($sort == '6'){$query = "format='exe'"; $_SESSION['num'] = '6'; $_SESSION['quir']=''; $_SESSION['quir']=$query;}
elseif ($sort == '7'){$query = "format='gif'||format='png'||format='jpg'||format='bmp'"; $_SESSION['num'] = '7'; $_SESSION['quir']=''; $_SESSION['quir']=$query;}
}

if (!isset($_SESSION['quir'])){
$_SESSION['quir'] = 'id';
$_SESSION['num']  = '1';
}

echo $div['title'].'Каталог файлов'.$div['title_end'];
echo $div['menu'];
echo 'Отобрать:<br />';
echo '<form action="?tid=sort" method="post">';
echo '<select name="sort">';
echo '<option value="1"'; if ($_SESSION['num'] == 1){echo 'selected="selected"';}echo '>Все</option>';
echo '<option value="2"'; if ($_SESSION['num'] == 2){echo 'selected="selected"';}echo '>Музыка</option>';
echo '<option value="3"'; if ($_SESSION['num'] == 3){echo 'selected="selected"';}echo '>Видео</option>';
echo '<option value="4"'; if ($_SESSION['num'] == 4){echo 'selected="selected"';}echo '>Игры/приложения</option>';
echo '<option value="5"'; if ($_SESSION['num'] == 5){echo 'selected="selected"';}echo '>Архивы</option>';
echo '<option value="6"'; if ($_SESSION['num'] == 6){echo 'selected="selected"';}echo '>ПК программы</option>';
echo '<option value="7"'; if ($_SESSION['num'] == 7){echo 'selected="selected"';}echo '>Изображения</option>';
echo '</select><br />';
echo '<input type="submit" value="Отобрать">';
echo '</form>';
echo '<form action="file_in.php?tid=chek" method="post">';
$num = $config_kat;  
$page = intval($_GET['page']);
if ($page == '') {$page=1;}
$posts=mysql_result(mysql_query("SELECT COUNT(*) FROM files WHERE $_SESSION[quir]"),0);
$total = intval(($posts - 1) / $num) + 1;  
if(empty($page) or $page < 0) $page = 1;  
if($page > $total) $page = $total;  
$start = $page * $num - $num;  
if (!$posts) {echo "<b>Файлов пока нет</b><br/>";}else{ 
$ms = mysql_query("SELECT * FROM files WHERE $_SESSION[quir] ORDER BY id DESC LIMIT $start, $num");
while($m=mysql_fetch_array($ms)){

$type_file  = strtolower($m['format']);

if ($type_file == 'gif'){
$icon = '<img src="../img/icon/gif.gif"/>';
}
elseif($type_file == 'jpg'){
$icon = '<img src="../img/icon/jpg.gif"/>';
}

elseif($type_file == 'exe'){
$icon = '<img src="../img/icon/exe.gif"/>';
}

elseif ($type_file == 'jar'){
$icon = '<img src="../img/icon/jar.gif"/>';
}

elseif ($type_file == 'jad'){
$icon = '<img src="../img/icon/jad.gif"/>';
}

elseif ($type_file == 'mp3'){
$icon = '<img src="../img/icon/mp.gif"/>';
}

elseif ($type_file == 'zip'){
$icon = '<img src="../img/icon/zip.gif"/>';
}

elseif ($type_file == 'rar'){
$icon = '<img src="../img/icon/zip.gif"/>';
}

elseif ($type_file == 'txt'){
$icon = '<img src="../img/icon/txt.gif"/>';
}

elseif ($type_file == 'htm'){
$icon = '<img src="../img/icon/htm.gif"/>';
}

elseif ($type_file == 'wav'){
$icon = '<img src="../img/icon/wav.gif"/>';
}

elseif ($type_file == 'mmf'){
$icon = '<img src="../img/icon/mmf.gif"/>';
}

elseif ($type_file == 'mid'){
$icon = '<img src="../img/icon/mid.gif"/>';
}else{
$icon = '<img src="../img/icon/file.gif"/>';
}



echo '<input type="checkbox" name="file[]" value="'.$m['id'].'"/>'.$icon.'<a href="file_open.php?id_file='.$m['id'].'">'.$m['name'].'</a>[<a href="file_in.php?tid=del&amp;id_file='.$m['id'].'">Удалить</a>]<br />';
}
$who   = 'файлов ';
$hvost = '?';
page($posts, $hvost, $page, $total, $who);
}
echo '<input type="submit" value="Удалить выбранное"/><br />';
echo '</form>';
echo '<img src="../img/home.png"/><a href="index.php">На главную</a><br />';
echo $div['menu_end'];

}else{
header('Location: index.php');
}

include_once("../themes/$config_themes/foot.php");
?>