Файл: user/wall/like.php
Строк: 59
<?php
/*
* Стена
* DCMS Special
* Модифицировал densnet
* Файл like.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/img/like.png[/img] $SexOcen Вашу [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]&act=wall" . 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/img/like.png[/img] $SexOcen Вашу [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]&act=wall" . 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);
}