Файл: user/avatar_like.php
Строк: 75
<?php
/* DCMS S (Special)
* Версия файла 0.0.1
* Дата последнего редактирования 12.11.2015
* Модифицировал densnet
*/
require_once '../sys/inc/start.php';
require_once H . 'sys/inc/compress.php';
require_once H . 'sys/inc/sess.php';
require_once H . 'sys/inc/settings.php';
require_once H . 'sys/inc/db_connect.php';
require_once H . 'sys/inc/ipua.php';
require_once H . 'sys/inc/fnc.php';
require_once H . 'sys/inc/user.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';