File size: 716B
<?
if (!isset($_GET['id']))
{
header("Location: mail.php?".SID."");
}
$id_ank=intval($_GET['id']);
$q = mysql_query("SELECT * FROM `$mysql[pref]users` WHERE `id` = '$id_ank';");
if(mysql_num_rows($q) != 0)
{
$ank = mysql_fetch_array($q, 1);
}
else
{
header("Location: mail.php?".SID."");
}
$q = mysql_query("SELECT COUNT(id) FROM `$mysql[pref]kont` WHERE `id_user` = '$user[id]' AND `id_kont` = '$id_ank';");
if (mysql_result($q, 0)!=0){header ("Location: mail.php?".SID."msg=kont_iss");exit;}
mysql_query("INSERT INTO `$mysql[pref]kont` (id_user, id_kont, nick) values('$user[id]', '$id_ank', '$ank[nickname]')");
header("Location: mail.php?".SID."&msg=kont_add");
exit;
?>