2011-03-28 14:21:28 +00:00
|
|
|
<?
|
|
|
|
authorize();
|
2013-06-11 08:01:24 +00:00
|
|
|
if (!is_number($_GET['friendid'])) {
|
|
|
|
error(404);
|
|
|
|
}
|
2011-03-28 14:21:28 +00:00
|
|
|
$FriendID = db_string($_GET['friendid']);
|
2013-06-11 08:01:24 +00:00
|
|
|
|
|
|
|
// Check if the user $FriendID exists
|
|
|
|
$DB->query("SELECT 1 FROM users_main WHERE ID = '$FriendID'");
|
|
|
|
if ($DB->record_count() == 0) {
|
|
|
|
error(404);
|
|
|
|
}
|
|
|
|
|
2013-04-19 08:00:55 +00:00
|
|
|
$DB->query("
|
|
|
|
INSERT IGNORE INTO friends
|
|
|
|
(UserID, FriendID)
|
|
|
|
VALUES ('$LoggedUser[ID]', '$FriendID')");
|
|
|
|
|
2011-03-28 14:21:28 +00:00
|
|
|
header('Location: friends.php');
|