Файл: social12/fav.php
Строк: 477
<?php
require 'sid.php';
require 'config.php';
$link = connect_db();
list($user, $id, $ps) = check_login($link);
whorm(0, 'fav');
include 'head.php';
include 'navigator.php';
$do = isset($_GET['do']) ? $_GET['do'] : NULL;
switch($do) {
default:
$num_1 = mysql_result(mysql_query("SELECT COUNT(*) FROM `fav` WHERE `user` = '$user[id]' AND `sec` = '1'"), 0);
$num_2 = mysql_result(mysql_query("SELECT COUNT(*) FROM `fav` WHERE `user` = '$user[id]' AND `sec` = '2'"), 0);
$num_3 = mysql_result(mysql_query("SELECT COUNT(*) FROM `fav` WHERE `user` = '$user[id]' AND `sec` = '3'"), 0);
$num_4 = mysql_result(mysql_query("SELECT COUNT(*) FROM `fav` WHERE `user` = '$user[id]' AND `sec` = '4'"), 0);
$num_5 = mysql_result(mysql_query("SELECT COUNT(*) FROM `fav` WHERE `user` = '$user[id]' AND `sec` = '5'"), 0);
$num_6 = mysql_result(mysql_query("SELECT COUNT(*) FROM `fav` WHERE `user` = '$user[id]' AND `sec` = '6'"), 0);
echo $div_title . $user['user'] . '/Закладки' . $div_end . $div_left . $div_razdel . '
С помощью функции закладок вы можете сохранить ссылку на интересного вам<br/>
человека, файл, фото, фотоальбом, заметки, обсуждения
' . $div_end . $div_tworazdel . '
<img src="ico/druzya.gif" alt=""/> <a href="fav.php?do=1">Люди</a> (' . $num_1 . ')
' . $div_end . $div_razdel . '
<img src="ico/files.gif" alt=""/> <a href="fav.php?do=2">Файлы</a> (' . $num_2 . ')
' . $div_end . $div_tworazdel . '
<img src="ico/zametki.gif" alt=""/> <a href="fav.php?do=6">Заметки</a> (' . $num_6 . ')
' . $div_end . $div_razdel . '
<img src="ico/foto.gif" alt=""/> <a href="fav.php?do=3">Фотоальбомы</a> (' . $num_3 . ')
' . $div_end . $div_tworazdel . '
<img src="ico/profile.gif" alt=""/> <a href="fav.php?do=4">Фотографии</a> (' . $num_4 . ')
' . $div_end . $div_razdel . '
<img src="ico/forum.gif" alt=""/> <a href="fav.php?do=5">Темы форума</a> (' . $num_5 . ')
' . $div_end;
break;
/*
* Запись
*/
case add:
if (isset($_GET['cat'])) {
$cat = my_int($_GET['cat']);
if ($cat <= 0 || $cat > 6) {
header('Location: index.php?' . $ref);
die();
}
if ($cat == 1) {
$uid = my_int($_GET['nk']);
############
if (!user_inf($uid)) {
header('Location: fav.php?do=' . $cat);
die();
}
############
} elseif ($cat == 2) {
$uid = my_int($_GET['f']);
############
$empty = mysql_query("SELECT `id` FROM `fo_files` WHERE `id` = '$uid' LIMIT 1");
if (mysql_num_rows($empty) == FALSE) {
header('Location: fav.php?do=' . $cat);
die();
}
############
} elseif ($cat == 3) {
$uid = my_int($_GET['a']);
############
$empty = mysql_query("SELECT `id` FROM `albums` WHERE `id` = '$uid' AND `type` = 'a' LIMIT 1");
if (mysql_num_rows($empty) == FALSE) {
header('Location: fav.php?do=' . $cat);
die();
}
############
} elseif ($cat == 4) {
$uid = my_int($_GET['p']);
############
$empty = mysql_query("SELECT `id` FROM `albums` WHERE `id` = '$uid' AND `type` = 'f' LIMIT 1");
if (mysql_num_rows($empty) == FALSE) {
header('Location: fav.php?do=' . $cat);
die();
}
############
} elseif ($cat == 5) {
$uid = my_int($_GET['t']);
############
$empty = mysql_query("SELECT `id` FROM `f_them` WHERE `id` = '$uid' LIMIT 1");
if (mysql_num_rows($empty) == FALSE) {
header('Location: fav.php?do=' . $cat);
die();
}
############
} elseif ($cat == 6) {
$uid = my_int($_GET['z']);
############
$empty = mysql_query("SELECT `id` FROM `zametki` WHERE `id` = '$uid' LIMIT 1");
if (mysql_num_rows($empty) == FALSE) {
header('Location: fav.php?do=' . $cat);
die();
}
############
}
$sec = htmlentities($_SERVER['HTTP_REFERER']);
$r = mysql_query("SELECT `id` FROM `fav` WHERE
`user` = '$user[id]'
AND
`sec` = '$cat'
AND
`uid` = '$uid' LIMIT 1");
if (mysql_num_rows($r) == FALSE) {
mysql_query("INSERT INTO `fav` SET `user` = '$user[id]', `sec` = '$cat', `path` = '$sec', `uid` = '$uid'");
header('Location: fav.php?do=' . $cat);
} else {
echo $div_title . 'Ошибка!' . $div_end;
err('Такая закладка уже есть у Вас!');
}
} else {
header('Location: fav.php?' . $ref);
}
break;
/*
* Люди
*/
case 1:
echo $div_title . $user['user'] . '/Закладки' . $div_end . $div_left . $div_razdel . '
<b>Люди</b>' . $div_end;
if (isset($_GET['x'])) {
$x = my_int($_GET['x']);
$empty = mysql_query("SELECT `id` FROM `fav` WHERE `user` = '$user[id]' AND `sec` = '1' AND `id` = '$x' LIMIT 1");
if (mysql_num_rows($empty) != FALSE) {
mysql_query("DELETE FROM `fav` WHERE `user` = '$user[id]' AND `sec` = '1' AND `id` = '$x' LIMIT 1");
header('Location: fav.php?do=1');
} else {
err('Ошибка!');
}
}
$look = mysql_result(mysql_query("SELECT COUNT(*) FROM `fav` WHERE `user` = '$user[id]' AND `sec` = '1'"), 0);
$n = new navigator($look, $user['onp_favs'], '?do=1&');
if ($look != FALSE) {
$i = 0;
$view = mysql_query("SELECT * FROM `fav` WHERE `user` = '$user[id]' AND `sec` = '1'");
while($a = mysql_fetch_assoc($view)) {
$ex = explode('/', $a['path']);
$d = ' <a href="fav.php?do=1&x='.$a['id'].'"><img src="ico/delete.gif" alt=""/></a>';
echo ($i ++ % 2) ? $div_tworazdel : $div_razdel;
echo '<a href="'.$a['path'].'">' . us($ex[3]) . $d . '</a>' . $div_end;
}
echo $n->navi();
} else {
echo 'Закладок нет!<br/>';
}
echo $div_end;
break;
/*
* Файлообменник
*/
case 2:
echo $div_title . $user['user'] . '/Закладки' . $div_end . $div_left . $div_razdel . '
<b>Файлы</b>' . $div_end;
if (isset($_GET['x'])) {
$x = my_int($_GET['x']);
$empty = mysql_query("SELECT `id` FROM `fav` WHERE `user` = '$user[id]' AND `sec` = '2' AND `id` = '$x' LIMIT 1");
if (mysql_num_rows($empty) != FALSE) {
mysql_query("DELETE FROM `fav` WHERE `user` = '$user[id]' AND `sec` = '2' AND `id` = '$x' LIMIT 1");
header('Location: fav.php?do=2');
} else {
err('Ошибка!');
}
}
$look = mysql_result(mysql_query("SELECT COUNT(*) FROM `fav` WHERE `user` = '$user[id]' AND `sec` = '2'"), 0);
$n = new navigator($look, $user['onp_favs'], '?do=2&');
if ($look != FALSE) {
$i = 0;
$view = mysql_query("SELECT * FROM `fav` WHERE `user` = '$user[id]' AND `sec` = '2'");
while($a = mysql_fetch_assoc($view)) {
preg_match('/(.*)i=([0-9]+)/is', $a['path'], $_out);
$d = ' <a href="fav.php?do=2&x='.$a['id'].'"><img src="ico/delete.gif" alt=""/></a>';
$alb = mysql_fetch_assoc(mysql_query("SELECT `id`, `title` FROM `fo_files` WHERE `id` = '$_out[2]'"));
$alb['title'] = (!empty($alb['id'])) ? $alb['title'] : '<u>[файл удален]</u>';
echo ($i ++ % 2) ? $div_tworazdel : $div_razdel;
echo '<a href="'.$a['path'].'">' . $alb['title'] . $d . '</a>' . $div_end;
}
echo $n->navi();
} else {
echo 'Закладок нет!<br/>';
}
echo $div_end;
break;
/*
* Фотоальбомы
*/
case 3:
echo $div_title . $user['user'] . '/Закладки' . $div_end . $div_left . $div_razdel . '
<b>Фотоальбомы</b>' . $div_end;
if (isset($_GET['x'])) {
$x = my_int($_GET['x']);
$empty = mysql_query("SELECT `id` FROM `fav` WHERE `user` = '$user[id]' AND `sec` = '3' AND `id` = '$x' LIMIT 1");
if (mysql_num_rows($empty) != FALSE) {
mysql_query("DELETE FROM `fav` WHERE `user` = '$user[id]' AND `sec` = '3' AND `id` = '$x' LIMIT 1");
header('Location: fav.php?do=3');
} else {
err('Ошибка!');
}
}
$look = mysql_result(mysql_query("SELECT COUNT(*) FROM `fav` WHERE `user` = '$user[id]' AND `sec` = '3'"), 0);
$n = new navigator($look, $user['onp_favs'], '?do=3&');
if ($look != FALSE) {
$i = 0;
$view = mysql_query("SELECT * FROM `fav` WHERE `user` = '$user[id]' AND `sec` = '3'");
while($a = mysql_fetch_assoc($view)) {
preg_match('/(.*)nk=([0-9]+)/is', $a['path'], $out);
preg_match('/(.*)i=([0-9]+)/is', $a['path'], $_out);
$d = ' <a href="fav.php?do=3&x='.$a['id'].'"><img src="ico/delete.gif" alt=""/></a>';
$alb = mysql_fetch_assoc(mysql_query("SELECT `id`, `name` FROM `albums` WHERE `type` = 'a' AND `user` = '$out[2]' AND `id` = '$_out[2]'"));
$alb['name'] = (!empty($alb['id'])) ? $alb['name'] : '<u>[альбом удален]</u>';
echo ($i ++ % 2) ? $div_tworazdel : $div_razdel;
echo '<a href="'.$a['path'].'">' . $alb['name'] . $d . '</a>' . $div_end;
}
echo $n->navi();
} else {
echo 'Закладок нет!<br/>';
}
echo $div_end;
break;
/*
* Фотографии
*/
case 4:
echo $div_title . $user['user'] . '/Закладки' . $div_end . $div_left . $div_razdel . '
<b>Фотографии</b>' . $div_end;
if (isset($_GET['x'])) {
$x = my_int($_GET['x']);
$empty = mysql_query("SELECT `id` FROM `fav` WHERE `user` = '$user[id]' AND `sec` = '4' AND `id` = '$x' LIMIT 1");
if (mysql_num_rows($empty) != FALSE) {
mysql_query("DELETE FROM `fav` WHERE `user` = '$user[id]' AND `sec` = '4' AND `id` = '$x' LIMIT 1");
header('Location: fav.php?do=4');
} else {
err('Ошибка!');
}
}
$look = mysql_result(mysql_query("SELECT COUNT(*) FROM `fav` WHERE `user` = '$user[id]' AND `sec` = '4'"), 0);
$n = new navigator($look, $user['onp_favs'], '?do=4&');
if ($look != FALSE) {
$i = 0;
$view = mysql_query("SELECT path FROM `fav` WHERE `user` = '$user[id]' AND `sec` = '4'");
while($a = mysql_fetch_assoc($view)) {
preg_match('/(.*)a=([0-9]+)/is', $a['path'], $out);
preg_match('/(.*)p=([0-9]+)/is', $a['path'], $_out);
$d = ' <a href="fav.php?do=4&x='.$a['id'].'"><img src="ico/delete.gif" alt=""/></a>';
$alb = mysql_fetch_assoc(mysql_query("SELECT `id`, `name` FROM `albums` WHERE `type` = 'f' AND `user` = '$out[2]' AND `id` = '$_out[2]'"));
$alb['name'] = (!empty($alb['id'])) ? $alb['name'] : '<u>[фото удалено]</u>';
$albname = (!empty($alb['name'])) ? $alb['name'] : 'Без названия';
echo ($i ++ % 2) ? $div_tworazdel : $div_razdel;
echo '<a href="'.$a['path'].'">' . $albname . $d . '</a>' . $div_end;
}
echo $n->navi();
} else {
echo 'Закладок нет!<br/>';
}
echo $div_end;
break;
/*
* Темы форума
*/
case 5:
echo $div_title . $user['user'] . '/Закладки' . $div_end . $div_left . $div_razdel . '
<b>Темы форума</b>' . $div_end;
if (isset($_GET['x'])) {
$x = my_int($_GET['x']);
$empty = mysql_query("SELECT `id` FROM `fav` WHERE `user` = '$user[id]' AND `sec` = '5' AND `id` = '$x' LIMIT 1");
if (mysql_num_rows($empty) != FALSE) {
mysql_query("DELETE FROM `fav` WHERE `user` = '$user[id]' AND `sec` = '5' AND `id` = '$x' LIMIT 1");
header('Location: fav.php?do=5');
} else {
err('Ошибка!');
}
}
$look = mysql_result(mysql_query("SELECT COUNT(*) FROM `fav` WHERE `user` = '$user[id]' AND `sec` = '5'"), 0);
$n = new navigator($look, $user['onp_favs'], '?do=5&');
if ($look != FALSE) {
$i = 0;
$view = mysql_query("SELECT * FROM `fav` WHERE `user` = '$user[id]' AND `sec` = '5'");
while($a = mysql_fetch_assoc($view)) {
$d = ' <a href="fav.php?do=5&x='.$a['id'].'"><img src="ico/delete.gif" alt=""/></a>';
preg_match('/(.*)p=([0-9]+)/is', $a['path'], $out);
preg_match('/(.*)t=([0-9]+)/is', $a['path'], $_out);
$th = mysql_fetch_assoc(mysql_query("SELECT `id`, `name` FROM `f_them` WHERE `rid` = '$out[2]' AND `id` = '$_out[2]'"));
$th['name'] = (!empty($th['id'])) ? $th['name'] : '<u>[тема удалена]</u>';
echo ($i ++ % 2) ? $div_tworazdel : $div_razdel;
echo '<a href="'.$a['path'].'">' . $th['name'] . $d . '</a>' . $div_end;
}
echo $n->navi();
} else {
echo 'Закладок нет!<br/>';
}
echo $div_end;
break;
/*
* Заметки
*/
case 6:
echo $div_title . $user['user'] . '/Закладки' . $div_end . $div_left . $div_razdel . '
<b>Заметки</b>' . $div_end;
if (isset($_GET['x'])) {
$x = my_int($_GET['x']);
$empty = mysql_query("SELECT `id` FROM `fav` WHERE `user` = '$user[id]' AND `sec` = '6' AND `id` = '$x' LIMIT 1");
if (mysql_num_rows($empty) != FALSE) {
mysql_query("DELETE FROM `fav` WHERE `user` = '$user[id]' AND `sec` = '6' AND `id` = '$x' LIMIT 1");
header('Location: fav.php?do=6');
} else {
err('Ошибка!');
}
}
$look = mysql_result(mysql_query("SELECT COUNT(*) FROM `fav` WHERE `user` = '$user[id]' AND `sec` = '6'"), 0);
$n = new navigator($look, $user['onp_favs'], '?do=6&');
if ($look != FALSE) {
$i = 0;
$view = mysql_query("SELECT * FROM `fav` WHERE `user` = '$user[id]' AND `sec` = '6'");
while($a = mysql_fetch_assoc($view)) {
preg_match('/(.*)i=([0-9]+)/is', $a['path'], $_out);
$d = ' <a href="fav.php?do=6&x='.$a['id'].'"><img src="ico/delete.gif" alt=""/></a>';
$alb = mysql_fetch_assoc(mysql_query("SELECT `id`, `title` FROM `zametki` WHERE `id` = '$_out[2]'"));
$alb['title'] = (!empty($alb['id'])) ? $alb['title'] : '<u>[заметка удалена]</u>';
echo ($i ++ % 2) ? $div_tworazdel : $div_razdel;
echo '<a href="'.$a['path'].'">' . $alb['title'] . $d . '</a>' . $div_end;
}
echo $n->navi();
} else {
echo 'Закладок нет!<br/>';
}
echo $div_end;
break;
case view:
$nk = my_int($_GET['nk']);
if (!user_inf($nk)) {
echo $div_title . 'Ошибка!' . $div_end;
err('Пользователь не найден!');
include 'foot.php';
exit();
}
if ($user['id'] == $nk) {
header('Location: zametki.php?do=read');
die();
}
if ($user['id'] != $nk) {
// запись всевидящего ока
$vok = mysql_query("SELECT `id` FROM `oko` WHERE `user` = '$nk' AND `who` = '$user[id]'");
if (mysql_num_rows($vok) == FALSE && $user['p_oko'] == 1) {
$r_n_d = mt_rand(1000000, 9999999);
mysql_query("INSERT INTO `oko` SET `id` = '$r_n_d', `user` = '$nk', `who` = '$user[id]', `where` = 'fav', `time` = '" . time() . "'");
} elseif (mysql_num_rows($vok) != FALSE && $user['p_oko'] == 1) {
mysql_query("UPDATE `oko` SET `where` = 'fav', `time` = '" . time() . "' WHERE `user` = '$nk' AND `who` = '$user[id]' LIMIT 1");
}
}
$num_1 = mysql_result(mysql_query("SELECT COUNT(*) FROM `fav` WHERE `user` = '$nk' AND `sec` = '1'"), 0);
$num_2 = mysql_result(mysql_query("SELECT COUNT(*) FROM `fav` WHERE `user` = '$nk' AND `sec` = '2'"), 0);
$num_3 = mysql_result(mysql_query("SELECT COUNT(*) FROM `fav` WHERE `user` = '$nk' AND `sec` = '3'"), 0);
$num_4 = mysql_result(mysql_query("SELECT COUNT(*) FROM `fav` WHERE `user` = '$nk' AND `sec` = '4'"), 0);
$num_5 = mysql_result(mysql_query("SELECT COUNT(*) FROM `fav` WHERE `user` = '$nk' AND `sec` = '5'"), 0);
$num_6 = mysql_result(mysql_query("SELECT COUNT(*) FROM `fav` WHERE `user` = '$nk' AND `sec` = '6'"), 0);
echo $div_title . us($nk) . '/Закладки' . $div_end . $div_left .
$div_razdel . '
<img src="ico/druzya.gif" alt=""/> <a href="fav.php?do=us1&nk='.$nk.'">Люди</a> (' . $num_1 . ')
' . $div_end . $div_tworazdel . '
<img src="ico/files.gif" alt=""/> <a href="fav.php?do=us2&nk='.$nk.'">Файлы</a> (' . $num_2 . ')
' . $div_end . $div_razdel . '
<img src="ico/zametki.gif" alt=""/> <a href="fav.php?do=us6&nk='.$nk.'">Заметки</a> (' . $num_6 . ')
' . $div_end . $div_tworazdel . '
<img src="ico/foto.gif" alt=""/> <a href="fav.php?do=us3&nk='.$nk.'">Фотоальбомы</a> (' . $num_3 . ')
' . $div_end . $div_razdel . '
<img src="ico/profile.gif" alt=""/> <a href="fav.php?do=us4&nk='.$nk.'">Фотографии</a> (' . $num_4 . ')
' . $div_end . $div_tworazdel . '
<img src="ico/forum.gif" alt=""/> <a href="fav.php?do=us5&nk='.$nk.'">Темы форума</a> (' . $num_5 . ')
' . $div_end;
break;
case us1:
$nk = my_int($_GET['nk']);
if (!user_inf($nk)) {
echo $div_title . 'Ошибка!' . $div_end;
err('Пользователь не найден!');
include 'foot.php';
exit();
}
echo $div_title . us($nk) . '/Закладки' . $div_end . $div_left . $div_razdel . '
<b>Люди</b>' . $div_end;
$fr = mysql_query("SELECT COUNT(*) FROM `friends` WHERE
`user` = '$user[id]'
AND
`who` = '$nk'
AND
`zajavka` = '1'
OR
`user` = '$nk'
AND
`who` = '$user[id]'
AND
`zajavka` = '1'");
if (user_inf($nk, 'fvr_user') == 2) {
err('Пользователь запретил просмотр его закладок!');
include_once 'foot.php';
exit();
} elseif (user_inf($nk, 'fvr_user') == 0 && mysql_result($fr, 0) == FALSE) {
err('Просмотр доступен только для друзей пользователя!');
include_once 'foot.php';
exit();
}
$look = mysql_result(mysql_query("SELECT COUNT(*) FROM `fav` WHERE `user` = '$nk' AND `sec` = '1'"), 0);
$n = new navigator($look, $user['onp_favs'], '?do=us1&nk='.$nk.'&');
if ($look != FALSE) {
$i = 0;
$view = mysql_query("SELECT * FROM `fav` WHERE `user` = '$nk' AND `sec` = '1'");
while($a = mysql_fetch_assoc($view)) {
$ex = explode('/', $a['path']);
echo ($i ++ % 2) ? $div_tworazdel : $div_razdel;
echo '<a href="'.$a['path'].'">' . nik($ex[3]) . '</a>' . $div_end;
}
echo $n->navi();
} else {
echo 'Закладок нет!<br/>';
}
echo $div_end;
break;
/*
* Файлообменник
*/
case us2:
$nk = my_int($_GET['nk']);
if (!user_inf($nk)) {
echo $div_title . 'Ошибка!' . $div_end;
err('Пользователь не найден!');
include 'foot.php';
exit();
}
echo $div_title . us($nk) . '/Закладки' . $div_end . $div_left . $div_razdel . '
<b>Файлы</b>' . $div_end;
$fr = mysql_query("SELECT COUNT(*) FROM `friends` WHERE
`user` = '$user[id]'
AND
`who` = '$nk'
AND
`zajavka` = '1'
OR
`user` = '$nk'
AND
`who` = '$user[id]'
AND
`zajavka` = '1'");
if (user_inf($nk, 'fvr_file') == 2) {
err('Пользователь запретил просмотр его закладок!');
include_once 'foot.php';
exit();
} elseif (user_inf($nk, 'fvr_file') == 0 && mysql_result($fr, 0) == FALSE) {
err('Просмотр доступен только для друзей пользователя!');
include_once 'foot.php';
exit();
}
$look = mysql_result(mysql_query("SELECT COUNT(*) FROM `fav` WHERE `user` = '$nk' AND `sec` = '2'"), 0);
$n = new navigator($look, $user['onp_favs'], '?do=us2&nk='.$nk.'&');
if ($look != FALSE) {
$i = 0;
$view = mysql_query("SELECT * FROM `fav` WHERE `user` = '$nk' AND `sec` = '2'");
while($a = mysql_fetch_assoc($view)) {
preg_match('/(.*)i=([0-9]+)/is', $a['path'], $_out);
$alb = mysql_fetch_assoc(mysql_query("SELECT `id`, `title` FROM `fo_files` WHERE `id` = '$_out[2]'"));
$alb['title'] = (!empty($alb['id'])) ? $alb['title'] : '<u>[файл удален]</u>';
echo ($i ++ % 2) ? $div_tworazdel : $div_razdel;
echo '<a href="'.$a['path'].'">' . $alb['title'] . '</a>' . $div_end;
}
echo $n->navi();
} else {
echo 'Закладок нет!<br/>';
}
echo $div_end;
break;
/*
* Фотоальбомы
*/
case us3:
$nk = my_int($_GET['nk']);
if (!user_inf($nk)) {
echo $div_title . 'Ошибка!' . $div_end;
err('Пользователь не найден!');
include 'foot.php';
exit();
}
echo $div_title . us($nk) . '/Закладки' . $div_end . $div_left . $div_razdel . '
<b>Фотоальбомы</b>' . $div_end;
$fr = mysql_query("SELECT COUNT(*) FROM `friends` WHERE
`user` = '$user[id]'
AND
`who` = '$nk'
AND
`zajavka` = '1'
OR
`user` = '$nk'
AND
`who` = '$user[id]'
AND
`zajavka` = '1'");
if (user_inf($nk, 'fvr_album') == 2) {
err('Пользователь запретил просмотр его закладок!');
include_once 'foot.php';
exit();
} elseif (user_inf($nk, 'fvr_album') == 0 && mysql_result($fr, 0) == FALSE) {
err('Просмотр доступен только для друзей пользователя!');
include_once 'foot.php';
exit();
}
$look = mysql_result(mysql_query("SELECT COUNT(*) FROM `fav` WHERE `user` = '$nk' AND `sec` = '3'"), 0);
$n = new navigator($look, $user['onp_favs'], '?do=us3&nk='.$nk.'&');
if ($look != FALSE) {
$i = 0;
$view = mysql_query("SELECT * FROM `fav` WHERE `user` = '$nk' AND `sec` = '3'");
while($a = mysql_fetch_assoc($view)) {
preg_match('/(.*)nk=([0-9]+)/is', $a['path'], $out);
preg_match('/(.*)i=([0-9]+)/is', $a['path'], $_out);
$alb = mysql_fetch_assoc(mysql_query("SELECT `id`, `name` FROM `albums` WHERE `type` = 'a' AND `user` = '$out[2]' AND `id` = '$_out[2]'"));
$alb['name'] = (!empty($alb['id'])) ? $alb['name'] : '<u>[альбом удален]</u>';
echo ($i ++ % 2) ? $div_tworazdel : $div_razdel;
echo '<a href="'.$a['path'].'">' . $alb['name'] . '</a>' . $div_end;
}
echo $n->navi();
} else {
echo 'Закладок нет!<br/>';
}
echo $div_end;
break;
/*
* Фотографии
*/
case us4:
$nk = my_int($_GET['nk']);
if (!user_inf($nk)) {
echo $div_title . 'Ошибка!' . $div_end;
err('Пользователь не найден!');
include 'foot.php';
exit();
}
echo $div_title . us($nk) . '/Закладки' . $div_end . $div_left . $div_razdel . '
<b>Фотографии</b>' . $div_end;
$fr = mysql_query("SELECT COUNT(*) FROM `friends` WHERE
`user` = '$user[id]'
AND
`who` = '$nk'
AND
`zajavka` = '1'
OR
`user` = '$nk'
AND
`who` = '$user[id]'
AND
`zajavka` = '1'");
if (user_inf($nk, 'fvr_foto') == 2) {
err('Пользователь запретил просмотр его закладок!');
include_once 'foot.php';
exit();
} elseif (user_inf($nk, 'fvr_foto') == 0 && mysql_result($fr, 0) == FALSE) {
err('Просмотр доступен только для друзей пользователя!');
include_once 'foot.php';
exit();
}
$look = mysql_result(mysql_query("SELECT COUNT(*) FROM `fav` WHERE `user` = '$nk' AND `sec` = '4'"), 0);
$n = new navigator($look, $user['onp_favs'], '?do=us4&');
if ($look != FALSE) {
$i = 0;
$view = mysql_query("SELECT * FROM `fav` WHERE `user` = '$nk' AND `sec` = '4'");
while($a = mysql_fetch_assoc($view)) {
preg_match('/(.*)nk=([0-9]+)/is', $a['path'], $out);
preg_match('/(.*)p=([0-9]+)/is', $a['path'], $_out);
$alb = mysql_fetch_assoc(mysql_query("SELECT `id`, `name` FROM `albums` WHERE `type` = 'f' AND `user` = '$out[2]' AND `id` = '$_out[2]'"));
$alb['name'] = (!empty($alb['id'])) ? $alb['name'] : '<u>[фото удалено]</u>';
$albname = (!empty($alb['name'])) ? $alb['name'] : 'Без названия';
echo ($i ++ % 2) ? $div_tworazdel : $div_razdel;
echo '<a href="'.$a['path'].'">' . $albname . '</a>' . $div_end;
}
echo $n->navi();
} else {
echo 'Закладок нет!<br/>';
}
echo $div_end;
break;
/*
* Темы форума
*/
case us5:
$nk = my_int($_GET['nk']);
if (!user_inf($nk)) {
echo $div_title . 'Ошибка!' . $div_end;
err('Пользователь не найден!');
include 'foot.php';
exit();
}
echo $div_title . us($nk) . '/Закладки' . $div_end . $div_left . $div_razdel . '
<b>Темы форума</b>' . $div_end;
$fr = mysql_query("SELECT COUNT(*) FROM `friends` WHERE
`user` = '$user[id]'
AND
`who` = '$nk'
AND
`zajavka` = '1'
OR
`user` = '$nk'
AND
`who` = '$user[id]'
AND
`zajavka` = '1'");
if (user_inf($nk, 'fvr_them') == 2) {
err('Пользователь запретил просмотр его закладок!');
include_once 'foot.php';
exit();
} elseif (user_inf($nk, 'fvr_them') == 0 && mysql_result($fr, 0) == FALSE) {
err('Просмотр доступен только для друзей пользователя!');
include_once 'foot.php';
exit();
}
$look = mysql_result(mysql_query("SELECT COUNT(*) FROM `fav` WHERE `user` = '$nk' AND `sec` = '5'"), 0);
$n = new navigator($look, $user['onp_favs'], '?do=us5&nk='.$nk.'&');
if ($look != FALSE) {
$i = 0;
$view = mysql_query("SELECT * FROM `fav` WHERE `user` = '$nk' AND `sec` = '5'");
while($a = mysql_fetch_assoc($view)) {
preg_match('/(.*)p=([0-9]+)/is', $a['path'], $out);
preg_match('/(.*)t=([0-9]+)/is', $a['path'], $_out);
$th = mysql_fetch_assoc(mysql_query("SELECT `id`, `name` FROM `f_them` WHERE `rid` = '$out[2]' AND `id` = '$_out[2]'"));
$th['name'] = (!empty($th['id'])) ? $th['name'] : '<u>[тема удалена]</u>';
echo ($i ++ % 2) ? $div_tworazdel : $div_razdel;
echo '<a href="'.$a['path'].'">' . $th['name'] . '</a>' . $div_end;
}
echo $n->navi();
} else {
echo 'Закладок нет!<br/>';
}
echo $div_end;
break;
/*
* Заметки
*/
case us6:
$nk = my_int($_GET['nk']);
if (!user_inf($nk)) {
echo $div_title . 'Ошибка!' . $div_end;
err('Пользователь не найден!');
include 'foot.php';
exit();
}
echo $div_title . us($nk) . '/Закладки' . $div_end . $div_left . $div_razdel . '
<b>Заметки</b>' . $div_end;
$fr = mysql_query("SELECT COUNT(*) FROM `friends` WHERE
`user` = '$user[id]'
AND
`who` = '$nk'
AND
`zajavka` = '1'
OR
`user` = '$nk'
AND
`who` = '$user[id]'
AND
`zajavka` = '1'");
if (user_inf($nk, 'fvr_note') == 2) {
err('Пользователь запретил просмотр его закладок!');
include_once 'foot.php';
exit();
} elseif (user_inf($nk, 'fvr_note') == 0 && mysql_result($fr, 0) == FALSE) {
err('Просмотр доступен только для друзей пользователя!');
include_once 'foot.php';
exit();
}
if (isset($_GET['x'])) {
$x = my_int($_GET['x']);
$empty = mysql_query("SELECT `id` FROM `fav` WHERE `user` = '$nk' AND `sec` = '6' AND `id` = '$x' LIMIT 1");
if (mysql_num_rows($empty) != FALSE) {
mysql_query("DELETE FROM `fav` WHERE `user` = '$nk' AND `sec` = '6' AND `id` = '$x' LIMIT 1");
header('Location: fav.php?do=6');
} else {
err('Ошибка!');
}
}
$look = mysql_result(mysql_query("SELECT COUNT(*) FROM `fav` WHERE `user` = '$nk' AND `sec` = '6'"), 0);
$n = new navigator($look, $user['onp_favs'], '?do=6&');
if ($look != FALSE) {
$i = 0;
$view = mysql_query("SELECT * FROM `fav` WHERE `user` = '$nk' AND `sec` = '6'");
while($a = mysql_fetch_assoc($view)) {
preg_match('/(.*)i=([0-9]+)/is', $a['path'], $_out);
$alb = mysql_fetch_assoc(mysql_query("SELECT `id`, `title` FROM `zametki` WHERE `id` = '$_out[2]'"));
$alb['title'] = (!empty($alb['id'])) ? $alb['title'] : '<u>[заметка удалена]</u>';
echo ($i ++ % 2) ? $div_tworazdel : $div_razdel;
echo '<a href="'.$a['path'].'">' . $alb['title'] . '</a>' . $div_end;
}
echo $n->navi();
} else {
echo 'Закладок нет!<br/>';
}
echo $div_end;
break;
/*
* просмотр закладок файлов
*/
case view_files:
echo $div_title . 'Закладки файлы' . $div_end . $div_left;
$u = my_int($_GET['u']);
$sql = mysql_result(mysql_query("SELECT COUNT(*) FROM `fav` WHERE `sec` = '2' AND `uid` = '$u'"), 0);
if ($sql != FALSE) {
$n = new navigator($sql, 10, '?do=view_files&u='.$u.'&');
$view = mysql_query("SELECT * FROM `fav` WHERE `sec` = '2' AND `uid` = '$u' ORDER BY `id` DESC {$n->limit}");
$i = 0;
while($a = mysql_fetch_assoc($view)) {
echo ($i ++ % 2) ? $div_tworazdel : $div_razdel;
echo us($a['user']) . $div_end;
}
echo $n->navi();
} else {
echo 'Не найдено.<br/>';
}
echo $div_end;
break;
/*
* просмотр закладок заметок
*/
case view_favs:
echo $div_title . 'Закладки заметки' . $div_end . $div_left;
$u = my_int($_GET['u']);
$sql = mysql_result(mysql_query("SELECT COUNT(*) FROM `fav` WHERE `sec` = '6' AND `uid` = '$u'"), 0);
if ($sql != FALSE) {
$n = new navigator($sql, 10, '?do=view_favs&u='.$u.'&');
$view = mysql_query("SELECT * FROM `fav` WHERE `sec` = '6' AND `uid` = '$u' ORDER BY `id` DESC {$n->limit}");
$i = 0;
while($a = mysql_fetch_assoc($view)) {
echo ($i ++ % 2) ? $div_tworazdel : $div_razdel;
echo $div_tworazdel . us($a['user']) . $div_end;
}
echo $n->navi();
} else {
echo 'Не найдено.<br/>';
}
echo $div_end;
break;
/*
* просмотр закладок альбомов
*/
case view_albums:
echo $div_title . 'Закладки альбомы' . $div_end . $div_left;
$u = my_int($_GET['u']);
$sql = mysql_result(mysql_query("SELECT COUNT(*) FROM `fav` WHERE `sec` = '3' AND `uid` = '$u'"), 0);
if ($sql != FALSE) {
$n = new navigator($sql, 10, '?do=view_albums&u='.$u.'&');
$view = mysql_query("SELECT * FROM `fav` WHERE `sec` = '3' AND `uid` = '$u' ORDER BY `id` DESC {$n->limit}");
$i = 0;
while($a = mysql_fetch_assoc($view)) {
echo ($i ++ % 2) ? $div_tworazdel : $div_razdel;
echo us($a['user']) . $div_end;
}
echo $n->navi();
} else {
echo 'Не найдено.<br/>';
}
echo $div_end;
break;
/*
* просмотр закладок фоток
*/
case view_photos:
echo $div_title . 'Закладки фотографии' . $div_end . $div_left;
$u = my_int($_GET['u']);
$sql = mysql_result(mysql_query("SELECT COUNT(*) FROM `fav` WHERE `sec` = '4' AND `uid` = '$u'"), 0);
if ($sql != FALSE) {
$n = new navigator($sql, 10, '?do=view_photos&u='.$u.'&');
$view = mysql_query("SELECT * FROM `fav` WHERE `sec` = '4' AND `uid` = '$u' ORDER BY `id` DESC {$n->limit}");
$i = 0;
while($a = mysql_fetch_assoc($view)) {
echo ($i ++ % 2) ? $div_tworazdel : $div_razdel;
echo $div_tworazdel . us($a['user']) . $div_end;
}
echo $n->navi();
} else {
echo 'Не найдено.<br/>';
}
echo $div_end;
break;
/*
* просмотр закладок форума
*/
case view_forum:
echo $div_title . 'Закладки форум' . $div_end . $div_left;
$u = my_int($_GET['u']);
$sql = mysql_result(mysql_query("SELECT COUNT(*) FROM `fav` WHERE `sec` = '5' AND `uid` = '$u'"), 0);
if ($sql != FALSE) {
$n = new navigator($sql, 10, '?do=view_forum&u='.$u.'&');
$view = mysql_query("SELECT * FROM `fav` WHERE `sec` = '5' AND `uid` = '$u' ORDER BY `id` DESC {$n->limit}");
$i = 0;
while($a = mysql_fetch_assoc($view)) {
echo ($i ++ % 2) ? $div_tworazdel : $div_razdel;
echo us($a['user']) . $div_end;
}
echo $n->navi();
} else {
echo 'Не найдено.<br/>';
}
echo $div_end;
break;
}
include 'foot.php';
?>