[code]
<?php
function Ip()
{
if (!empty($_SERVER[\'HTTP_CLIENT_IP\']))
{
$ip=$_SERVER[\'HTTP_CLIENT_IP\'];
}
elseif (!empty($_SERVER[\'HTTP_X_FORWARDED_FOR\']))
{
$ip=$_SERVER[\'HTTP_X_FORWARDED_FOR\'];
}
else
{
$ip=$_SERVER[\'REMOTE_ADDR\'];
}
return $ip;
}
$ip=Ip();
if(isset($_GET[\'like\'])){
if(mysql_num_rows(mysql_query(\"SELECT COUNT(*) FROM `like` WHERE `ip` = \'\".$ip.\"\'\"
)==0){
mysql_query(\"INSERT INTO `like` SET `ip` = \'\".$ip.\"\'\"
;
}else{
$error=\'Вы уже лайкали!\";
}
}
if(!empty($error))echo $error;
////////////Тут контент
echo\"<a href=\'?like\'>Мне понравилось</a><br>\";
echo\"Понравилось уже \".mysql_result(mysql_query(\"SELECT COUNT(*) FROM `like`\"
,0).\"\";
?>
[/code]