Файл: loads/inc/ff_rating.php
Строк: 24
<?php
if (isset($user)) {
if (@$_GET['rating'] == "up") {
if (mysql_result(mysql_query("SELECT COUNT(*) FROM `loads_rating` WHERE `id_user` = '$user[id]' AND `name` = '$file' AND `path` = '$path' LIMIT 1"), 0) != 0) {
$err = 'Вы уже голосовали за этот файл';
} else {
if (mysql_query("UPDATE loads_list SET rating = rating +1 WHERE name = '$file' AND `path` = '$path' LIMIT 1")) {
if (mysql_query("UPDATE loads_list SET kol = kol +1 WHERE name = '$file' AND `path` = '$path' LIMIT 1")) {
if (mysql_query("UPDATE loads_list SET `user` = '" . $user['nick'] . "' WHERE `name` = '$file' AND `path` = '$path' LIMIT 1")) {
if (mysql_query("INSERT INTO `loads_rating` (`id_user`, `name`, `path`) values('" . $user['id'] . "', '$file', '$path')")) {
msg("Ваш + успешно принят");
} else {
$err = 'Ошыбка';
}
}
}
}
}
}
if (@$_GET['rating'] == "down") {
if (mysql_result(mysql_query("SELECT COUNT(*) FROM `loads_rating` WHERE `id_user` = '$user[id]' AND `name` = '$file' AND `path` = '$path' LIMIT 1"), 0) != 0) {
$err = 'Вы уже голосовали за этот файл';
} else {
if (mysql_query("UPDATE loads_list SET rating = rating -1 WHERE name = '$file' AND `path` = '$path' LIMIT 1")) {
if (mysql_query("UPDATE loads_list SET kol = kol +1 WHERE name = '$file' AND `path` = '$path' LIMIT 1")) {
if (mysql_query("UPDATE loads_list SET `user` = '" . $user['nick'] . "' WHERE `name` = '$file' AND `path` = '$path' LIMIT 1")) {
if (mysql_query("INSERT INTO `loads_rating` (`id_user`, `name`, `path`) values('" . $user['id'] . "', '$file', '$path')")) {
msg("Ваш - успешно принят");
} else {
$err = 'Ошыбка';
}
}
}
}
}
}
}
?>