Файл: user/wall/like.php
Строк: 57
<?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';
$wall = mysql_fetch_array(mysql_query("select * from `wall` where `id` = '" . intval($_GET['id']) . "';"));
$ank = get_user($wall['id_user']);
if (isset($_GET['like']) && isset($user)) {
if (mysql_result(mysql_query("SELECT COUNT(*) FROM `wall_like` WHERE `id_komm` = '" . intval($_GET['id']) . "' AND `id_user` = '$user[id]' LIMIT 1"), 0) != 0) {
} else {
mysql_query("INSERT INTO `wall_like` (`id_user`, `id_komm`) values('$user[id]', '" . intval($_GET['id']) . "')");
}
if (isset($user) && $user['id'] != $ank['id']) {
$msgok = "[img]http://$_SERVER[HTTP_HOST]/style/icons/like.png[/img] " . ($user['sex'] ? 'оценил' : 'оценила') . " Вашу [url=/wall/comments.php?id=$wall[id]]запись[/url].";
mysql_query("INSERT INTO `notification` (`id_user`, `id_kont`, `msg`, `time`) values('$user[id]', '$ank[id]', '$msgok', '$time')");
}
header("Location: /info.php?id=$ank[id]" . SID);
}
if (isset($_GET['likes']) && isset($user)) {
if (mysql_result(mysql_query("SELECT COUNT(*) FROM `wall_like` WHERE `id_komm` = '" . intval($_GET['id']) . "' AND `id_user` = '$user[id]' LIMIT 1"), 0) != 0) {
} else {
mysql_query("INSERT INTO `wall_like` (`id_user`, `id_komm`) values('$user[id]', '" . intval($_GET['id']) . "')");
}
if (isset($user) && $user['id'] != $ank['id']) {
$msgok = "[img]http://$_SERVER[HTTP_HOST]/style/icons/like.png[/img] " . ($user['sex'] ? 'оценил' : 'оценила') . " Вашу [url=/wall/comments.php?id=$wall[id]]запись[/url].";
mysql_query("INSERT INTO `notification` (`id_user`, `id_kont`, `msg`, `time`) values('$user[id]', '$ank[id]', '$msgok', '$time')");
}
header("Location: /user/wall/comments.php?id=$wall[id]" . SID);
}
if (isset($_GET['unlike']) && isset($user)) {
mysql_query("DELETE FROM `wall_like` WHERE `id_user` = '$user[id]' AND `id_komm` = '" . intval($_GET['id']) . "' LIMIT 1");
header("Location: /info.php?id=$ank[id]" . SID);
}
if (isset($_GET['unlikes']) && isset($user)) {
mysql_query("DELETE FROM `wall_like` WHERE `id_user` = '$user[id]' AND `id_komm` = '" . intval($_GET['id']) . "' LIMIT 1");
header("Location: /user/wall/comments.php?id=$wall[id]" . SID);
}