Размер файла: 1.43Kb
<?php
require '../inc/func.php';
bk_head('Adding 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['tt'].' </div><div class="list1">';
if ($userid == $fid)
{
err (''.$lng_friends['me'].'');
}
elseif (mysql_num_rows(mysql_query("SELECT id FROM friend_reqs WHERE (uid = '$userid' AND fid = '$fid' ) OR (uid = '$fid' AND fid = '$userid') "))!= 0)
{
err (''.$lng_friends['pending'].'');
}
elseif(mysql_num_rows(mysql_query("SELECT id FROM friends WHERE (uid = '$userid' AND fid = '$fid' ) OR (uid = '$fid' AND fid = '$userid') "))!= 0)
{
err (''. user_info($fid, 'username') .' '.$lng_friends['already'].' ');
}
else
{
mysql_query("INSERT INTO friend_reqs (uid,fid,time) VALUES ('$userid','$fid',".time().") ");
err (''.$lng_friends['sent'].' '. user_info($fid, 'username') .'');
}
echo '</div>';
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();
?>