Файл: user/avatar_like.php
Строк: 63
<?php
/* DCMS Special)
* Дата последнего редактирования 22.12.2015
* Модифицировал densnet
*/
foreach (array('start', 'compress', 'sess', 'settings', 'db_connect', 'ipua', 'fnc', 'user') as $inc) {
require_once "../sys/inc/{$inc}.php";
}
if (isset($user)) {
$ank['id'] = $user['id'];
}
if (isset($_GET['id'])) {
$ank['id'] = intval($_GET['id']);
}
$ank = get_user($ank['id']);
$set['title'] = 'Аватар - ' . $ank['nick'] . '';
require_once H . 'sys/inc/thead.php';
aut();
err();
if (isset($_GET['like']) && isset($user)) {
if (mysql_result(mysql_query("SELECT COUNT(*) FROM `avatar_like` WHERE `id_komm` = '" . intval($_GET['id']) . "' AND `id_user` = '$user[id]' LIMIT 1"), 0) != 0) {
} else {
mysql_query("INSERT INTO `avatar_like` (`id_user`, `id_komm`, `like`) values('$user[id]', '" . intval($_GET['id']) . "', '1')");
}
if (isset($user) && $user['id'] != $ank['id']) {
$msg = "" . ($user['sex'] ? 'оценил' : 'оценила') . " Ваш [url=/user/avatar_comm.php?id=$ank[id]]аватар[/url].";
mysql_query("INSERT INTO `notification` (`id_user`, `id_kont`, `msg`, `time`) values('$user[id]', '$ank[id]', '$msg', '$time')");
}
header("Location: avatar_comm.php?id=$ank[id]" . SID);
}
if (isset($_GET['likes']) && isset($user)) {
if (mysql_result(mysql_query("SELECT COUNT(*) FROM `avatar_like` WHERE `id_komm` = '" . intval($_GET['id']) . "' AND `id_user` = '$user[id]' LIMIT 1"), 0) != 0) {
} else {
mysql_query("INSERT INTO `avatar_like` (`id_user`, `id_komm`, `like`) values('$user[id]', '" . intval($_GET['id']) . "', '1')");
}
if (isset($user) && $user['id'] != $ank['id']) {
$msg = "" . ($user['sex'] ? 'оценил' : 'оценила') . " Ваше [url=/user/avatar_comm.php?id=$ank[id]]фото[/url].";
mysql_query("INSERT INTO `notification` (`id_user`, `id_kont`, `msg`, `time`) values('$user[id]', '$ank[id]', '$msg', '$time')");
}
header("Location: /info.php?id=$ank[id]" . SID);
}
if (isset($_GET['likess']) && isset($user)) {
if (mysql_result(mysql_query("SELECT COUNT(*) FROM `avatar_like` WHERE `id_komm` = '" . intval($_GET['id']) . "' AND `id_user` = '$user[id]' LIMIT 1"), 0) != 0) {
} else {
mysql_query("INSERT INTO `avatar_like` (`id_user`, `id_komm`, `like`) values('$user[id]', '" . intval($_GET['id']) . "', '0')");
}
if (isset($user) && $user['id'] != $ank['id']) {
$msg = "" . ($user['sex'] ? 'не оценил' : 'не оценила') . " Ваше [url=/user/avatar_comm.php?id=$ank[id]]фото[/url].";
mysql_query("INSERT INTO `notification` (`id_user`, `id_kont`, `msg`, `time`) values('$user[id]', '$ank[id]', '$msg', '$time')");
}
header("Location: /info.php?id=$ank[id]" . SID);
}
if (isset($_GET['unlike']) && isset($user)) {
mysql_query("DELETE FROM `avatar_like` WHERE `id_user` = '$user[id]' AND `id_komm` = '" . intval($_GET['id']) . "' LIMIT 1");
header("Location: avatar_comm.php?id=$ank[id]" . SID);
}
if (isset($_GET['unlikes']) && isset($user)) {
mysql_query("DELETE FROM `avatar_like` WHERE `id_user` = '$user[id]' AND `id_komm` = '" . intval($_GET['id']) . "' LIMIT 1");
header("Location: /info.php?id=$ank[id]" . SID);
}
require_once H . 'sys/inc/tfoot.php';