Размер файла: 1.58Kb
<?php
require '../inc/func.php';
bk_head('Adding $lng_friends');
require '../inc/head.php';
if (!$user)
{
header('location: index.php') ;
}
$fid = (isset($_GET['fid'])) ? num($_GET['fid']) : NULL;
if(empty($fid)){
header('location: /index.php');
}
$ch_fid = mysql_query("SELECT `id` FROM `users` WHERE `id` = '".$fid."' ");
if(!mysql_num_rows($ch_fid)){
header('location: /index.php');
}
echo '<div class="list1"><div class="tt"> '.$lng_friends['addtt'].'</div>';
if (friends($userid,$fid) == '1')
{
$requ = mysql_query("INSERT INTO friends (uid,fid,time) VALUES ('$userid','$fid',".time().")");
$reqf = mysql_query("INSERT INTO friends (uid,fid,time) VALUES ('$fid','$userid',".time().")");
if ($requ && $reqf)
{
echo '<p class="left_bot">'.$lng_friends['success'].'</p>';
mysql_query("DELETE FROM friend_reqs WHERE (uid='$userid' AND fid='$fid') OR (uid='$fid' AND fid='$userid') ");
mysql_query("OPTIMIZE TABLE `friend_reqs`");
}
else
{
echo '<p class="left_bot">'.$lng_friends['cant'].' '. user_info($fid, 'username') .' '.$lng_friends['fl'].'</p>';
}
}
elseif ($lng_friends($userid,$fid) == '2')
{
err (''. user_info($fid, 'username') .' '.$lng_friends['already'].'!');
}
else
{
err (''.$lng_friends['cant'].' '. user_info($fid, 'username') .' '.$lng_friends['fl'].'');
}
echo '» <a href="index.php"> '.$lng_friends['back'].' </a><hr><div class="shadow"><a href="/users/my.php"><b>My Menu</b></a> | <a href="/u/'.$userid.'"><b>Profile</b></a> | <a href="/exit.php"><b>LogOut</b></a></div></div>';
bk_foot();
?>