Mark,
<?php
include_once('./system/config.php');
$sys['title'] = 'Главная';
include_once('./system/head.php');
$id = abs(intval($_GET['id']));
$type = in_array($_GET['type'], array('plus', 'minus')) ? mysql_real_escape_string($_GET['type']) : null;
$check_ip = mysql_num_rows(mysql_query("SELECT `id` FROM `vote_ip` WHERE `ip` = '".$_SERVER['REMOTE_ADDR']."' AND `id_note` = '".$id."' LIMIT 1"
);
if($check_ip > 0) echo '<div class="vib">Вы уже голосовали!</div>';
if($check_ip == 0 && $type) {
mysql_query("UPDATE `note` SET `rate_".$type."` = `rate_".$type."` + 1 WHERE `id` = '".$id."'"
;
mysql_query("INSERT INTO `vote_ip` SET `id_note` = '".$id."', `ip` = '".$_SERVER['REMOTE_ADDR']."'"
;
echo '<div class="vib">Спасибо, Ваш голос учтен</div>';}
echo '<div class="vib"><a href="/view_note.php?id='.$id.'">Вернуться к статье</a></div>';
include_once('./system/foot.php');
?>