Файл: loads/view.php
Строк: 62
<?php
require '../system/sid.php';
require '../system/config.php';
if (!empty($_SESSION['us']))
{
include '../system/user.php';
whorm(0, 'loads');
}
include '../system/head.php';
include '../system/navigator.php';
$r = my_int($_GET['r']);
$test = mysql_query("SELECT * FROM `loads_r` WHERE `id` = '$r' LIMIT 1");
$name_rzd = mysql_fetch_assoc($test);
echo $div_title . 'WAP-скрипты' . $div_end .
$div_menu . '
<img src="../ico/up.gif" alt=""/> <a href="index.php?">WAP-скрипты</a>
| <b>' . $name_rzd['name'] . '</b>
' . $block . '
<a href="search.php?">Поиск</a><br/>
<a href="pop.php?">Популярные</a> |
<a href="new.php?">Новые</a><br/>' . $div_end;
if (mysql_num_rows($test) == FALSE) {
err('Раздела не существует!');
include '../system/foot.php';
exit();
}
if (isset($_GET['del']))
{
if ($user['level'] != 5) {
header('Location: index.php');
die();
}
$del = my_int($_GET['del']);
$sql = mysql_query("SELECT * FROM `loads_f` WHERE `id` = '$del' LIMIT 1");
if (mysql_num_rows($sql) != FALSE) {
$info = mysql_fetch_assoc($sql);
$TXT = '<small>(' . date('d-m-y в H:i:s') . ')</small><br/>' . elite($user['id']) . ' ' . $user['user'] . ' удалил файл <b>' . $info['title'] . '</b> из ЗЦ.';
mysql_query("INSERT INTO admin_logs SET text = '$TXT'");
if (file_exists($info['url'])) unlink($info['url']);
if (file_exists($info['screen'])) unlink($info['screen']);
mysql_query("DELETE FROM `loads_f` WHERE `id` = '$del' LIMIT 1");
mysql_query("DELETE FROM `loads_komm` WHERE `uid` = '$del'");
mysql_query("DELETE FROM `rating_loads` WHERE `uid` = '$del'");
header('Location: r-'.$r);
} else {
header('Location: r-'.$r);
}
}
$count = mysql_result(mysql_query("SELECT COUNT(id) FROM `loads_f` WHERE `cat` = '$r'"), 0);
$n = new navigator($count, 10, 'r-'.$r.'&');
$i = 0;
if ($count != FALSE) {
$view = mysql_query("SELECT * FROM `loads_f` WHERE `cat` = '$r' ORDER BY `id` DESC {$n->limit}");
while($a = mysql_fetch_assoc($view)) {
$ext = strtolower(strrchr($a['url'], '.'));
if ($ext == '.zip') $format = '<img src="img/zip.gif" alt="*"/> ';
elseif ($ext == '.rar') $format = '<img src="img/rar.gif" alt="*"/> ';
elseif ($ext == '.gz') $format = '<img src="img/gz.gif" alt="*"/> ';
elseif ($ext == '.tar') $format = '<img src="img/tar.gif" alt="*"/> ';
else $format = '<img src="img/unknown.gif" alt="*"/> ';
#######################
$size = filesize($a['url']);
$size = get_size($size);
if ($user['level'] == 5) {
$delete = '<a href="delfile-'.$r.'-'.$a['id'].'"><img src="../ico/delete.png" alt="x"/></a> ';
}
$inf_file = (!empty($a['info'])) ? $a['info'] : 'Без описания';
$cont = (mb_strlen($inf_file, 'UTF8') > 100)
? mb_substr($inf_file, 0, 100, 'UTF8') . '...'
: $inf_file;
echo ($i ++ % 2) ? $div_tworazdel : $div_razdel;
echo $delete . ' ' . $format . '
<a href="info-'.$a['id'].'">' . $a['title'] . '</a> (' . $size . ')
<br/>' . bb_code($cont) . $div_end;
}
echo $n->navi();
} else {
echo 'Файлов нет!<br/>';
}
include '../system/foot.php';
?>