<?
include_once '../sys/inc/start.php';
include_once '../sys/inc/compress.php';
include_once '../sys/inc/sess.php';
include_once '../sys/inc/home.php';
include_once '../sys/inc/settings.php';
include_once '../sys/inc/db_connect.php';
include_once '../sys/inc/ipua.php';
include_once '../sys/inc/fnc.php';
include_once '../sys/inc/user.php';
only_reg();
$set['title']='Мои закладки';
include_once '../sys/inc/thead.php';
title();
if (isset($_POST['change']) && isset($_GET['id']) && isset($_POST['name']) && $_POST['name']!=NULL && isset($_POST['url']) && $_POST['url']!=NULL && isset($_POST['width']) && $_POST['width']!=NULL && isset($_POST['heigh']) && $_POST['heigh']!=NULL)
{
$id=intval($_GET['id']);
$br=esc(stripcslashes(htmlspecialchars($_POST['br'])));
$name=esc(stripcslashes(htmlspecialchars($_POST['name'])));
$url=esc(htmlspecialchars($_POST['url']));
$width=esc(stripcslashes(htmlspecialchars($_POST['width'])));
$heigh=esc(htmlspecialchars($_POST['heigh']));
mysql_query("UPDATE `zakladki` SET `name` = '$name', `url` = '$url', `width` = '$width', `heigh` = '$heigh', `br` = '$br' WHERE `id` = '$id' AND `id_user`='$user[id]' LIMIT 1");
msg('Закладка успешно изменена.');
}
if (isset($_GET['id']) && isset($_GET['act']) && mysql_result(mysql_query("SELECT COUNT(*) FROM `zakladki` WHERE `id_user`='$user[id]' AND `id` = '".intval($_GET['id'])."'"),0))
{
$menu=mysql_fetch_assoc(mysql_query("SELECT * FROM `zakladki` WHERE  `id_user`='$user[id]' AND `id` = '".intval($_GET['id'])."' LIMIT 1"));
if ($_GET['act']=='del')
{
mysql_query("DELETE FROM `zakladki` WHERE `id_user`='$user[id]' AND `id` = '".intval($_GET['id'])."' LIMIT 1");
msg('Закладка успешно удалена.');
}
}
err();
aut();
echo "<table><tr>";
$zakladki=mysql_query("SELECT * FROM `zakladki` WHERE `id_user`='$user[id] limit 3'");
while ($zakladka = mysql_fetch_assoc($zakladki))
{
echo "<td class='p_m'><center><iframe width=$zakladka[width] height=$zakladka[heigh] src='$zakladka[url]' scrolling=no></iframe><br><a href='$zakladka[url]'>$zakladka[name]</a> <a href='?id=$zakladka[id]&amp;act=del&amp;$passgen'><img src='/zakladki/icons/del.png' alt='х'></a><center></td>";
if ($zakladka['br']=='no')echo " ";
else echo "</tr><tr>";
}
echo "</tr></table>";
echo "<img src='/zakladki/icons/add.png'> <a href='/zakladki/add.php?add=$passgen'>Добавить</a>";
include_once '../sys/inc/tfoot.php';
?>