Просмотр файла friends/remove.php

Размер файла: 1.31Kb
<?php 

require '../inc/func.php';
bk_head('Removing 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">&nbsp;'.$lng_friends['rm'].'</div>';
$q_f = mysql_query("SELECT id FROM friends WHERE (uid = $userid AND fid = $fid) OR (uid = $fid AND fid = $userid)");

if (!mysql_num_rows($q_f))
{

err ('ko thể hủy kết bạn với '. user_info($fid, 'username') .'');

}else{
    $req = mysql_query("DELETE FROM friends WHERE (uid='$userid' AND fid='$fid') OR (uid='$fid' AND fid='$userid') ");
	if ($req)
	{
	    err (''.$lng_friends['dnsuccess'].' '. user_info($fid, 'username') .'');
		mysql_query("OPTIMIZE TABLE `friends`");
	}
	else 
	{
	    err (''.$lng_friends['cdn'].' '. user_info($fid, 'username') .'!');
	}
}

echo '&raquo; <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();
?>