mirror of
https://github.com/pierre42100/ComunicAPI
synced 2025-06-18 16:18:04 +00:00
Improved security of "sendRequest" method
This commit is contained in:
@ -44,6 +44,14 @@ class friendsController{
|
||||
//Extract informations and process request
|
||||
$friendID = toInt($_POST['friendID']);
|
||||
|
||||
//Check friendID validity
|
||||
if(!check_user_id($friendID))
|
||||
Rest_fatal_error(401, "The user ID you specified is invalid !");
|
||||
|
||||
//Check if the user exists
|
||||
if(!CS::get()->components->user->exists($friendID))
|
||||
Rest_fatal_error(401, "Specifed user does not exist!");
|
||||
|
||||
//Check if the two persons are already friend
|
||||
if(CS::get()->components->friends->are_friend(userID, $friendID))
|
||||
Rest_fatal_error(401, "The two personns are already friend !");
|
||||
|
Reference in New Issue
Block a user