Файл: profiwm.pp.ua/zakl.php
Строк: 32
<?php
require 'system/sid.php';
require 'system/config.php';
include 'system/user.php';
include 'system/head.php';
include 'system/navigator.php';
whorm(0, 'zakl');
echo $div_title . 'Закладки' . $div_end;
if (isset($_GET['get']))
{
$get = my_int($_GET['get']);
$t = mysql_query("SELECT id FROM f_them WHERE id = '$get' LIMIT 1");
$d = mysql_query("SELECT id FROM zakl WHERE uid = '$get' AND user = '$user[id]' LIMIT 1");
if (mysql_num_rows($t) == false)
{
err('Ошибка при добавлении закладки!');
}
elseif (mysql_num_rows($d) != false)
{
err('У вас уже есть эта закладка!');
}
else
{
mysql_query("INSERT INTO zakl SET uid = '$get', user = '$user[id]'");
header('location: zakl.php');
}
}
if (isset($_GET['x']))
{
$x = my_int($_GET['x']);
$t = mysql_query("SELECT id FROM zakl WHERE id = '$x' AND user = '$user[id]' LIMIT 1");
if (mysql_num_rows($t) == false)
{
err('Ошибка! Закладка не найдена.');
}
else
{
mysql_query("DELETE FROM zakl WHERE id = '$x' AND user = '$user[id]' LIMIT 1");
header('location: zakl.php');
}
}
$count = mysql_result(mysql_query("SELECT COUNT(id) FROM zakl WHERE user = '$user[id]'"), 0);
if ($count != 0)
{
$n = new navigator($count, $user['onp_favs'], '?');
$sql = mysql_query("SELECT zakl.*,
(SELECT id FROM f_them WHERE zakl.uid = f_them.id) AS i,
(SELECT rid FROM f_them WHERE zakl.uid = f_them.id) AS p,
(SELECT razdel_id FROM f_them WHERE zakl.uid = f_them.id) AS r,
(SELECT name FROM f_them WHERE zakl.uid = f_them.id) AS n
FROM zakl WHERE user = '$user[id]' ORDER BY id DESC {$n->limit}");
$i = 0;
while($a = mysql_fetch_assoc($sql))
{
$name = (!empty($a['i'])) ? $a['n'] : '<b>Тема была удалена!</b>';
echo ($i ++ % 2) ? $div_razdel : $div_tworazdel;
$d = '<a href="dzakl-'.$a['id'].'"><img src="ico/delete.png" alt=""/></a> ';
echo $d . '<a href="forum/them-'.$a['r'].'-'.$a['p'].'-'.$a['i'].'">' . $name . '</a>' . $div_end;
}
echo $n->navi();
} else {
echo 'Закладок нет.<br/>';
}
include 'system/foot.php';
?>