Файл: user/avatar_like.php
Строк: 62
<?php
require_once '../sys/inc/start.php';
require_once '../sys/inc/compress.php';
require_once '../sys/inc/sess.php';
require_once '../sys/inc/settings.php';
require_once '../sys/inc/db_connect.php';
require_once '../sys/inc/ipua.php';
require_once '../sys/inc/fnc.php';
require_once '../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 '../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`) values('$user[id]', '" . intval($_GET['id']) . "')");
}
if (isset($user) && $user['id'] != $ank['id']) {
$msg = "[img]http://$_SERVER[HTTP_HOST]/style/icons/like.png[/img] " . ($user['sex'] ? 'оценил' : 'оценила') . " ваш [url=/user/avatar_comm.php?id=$ank[id]]аватар[/url].";
mysql_query("INSERT INTO `tape` (`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`) values('$user[id]', '" . intval($_GET['id']) . "')");
}
if (isset($user) && $user['id'] != $ank['id']) {
$msg = "[img]http://$_SERVER[HTTP_HOST]/style/icons/like.png[/img] " . ($user['sex'] ? 'оценил' : 'оценила') . " ваш [url=/user/avatar_comm.php?id=$ank[id]]аватар[/url].";
mysql_query("INSERT INTO `tape` (`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 '../sys/inc/tfoot.php';