Файл: test.masteram.us/fanat_add.php
Строк: 30
<?
include 'Core.php';
only_reg();
if (!isset($_GET['id'])){header("Location: index.php?1".SID);exit;}
$ank['id']=intval($_GET['id']);
if (mysql_result(mysql_query("SELECT COUNT(*) FROM `user` WHERE `id` = '$ank[id]' LIMIT 1"),0)==0){header("Location: index.php?".SID);exit;}
if (mysql_result(mysql_query("SELECT COUNT(*) FROM `fanat` WHERE (`user` = '$user[id]' AND `frend` = '$ank[id]') OR (`user` = '$ank[id]' AND `frend` = '$user[id]') LIMIT 1"),0)==1){header("Location: index.php?".SID);exit;}
if (mysql_result(mysql_query("SELECT COUNT(*) FROM `fanat_obm` WHERE (`user` = '$user[id]' AND `to` = '$ank[id]') OR (`user` = '$ank[id]' AND `to` = '$user[id]') LIMIT 1"),0)==1){header("Location: index.php?".SID);exit;}
if ($ank['id']==$user['id']){header("Location: index.php?".SID);exit;}
mysql_query("INSERT INTO `fanat_obm` (`user`, `to`, `time`) values('$user[id]', '$ank[id]', '$time')");
mysql_query("OPTIMIZE TABLE `fanat_obm`");
header("Location: fanat.php?add".SID);
exit;
?>