<?php 
	$id = (int)abs($_GET['cancel']);
	$code = (int)abs($_GET['c']);

	$queyFriedQuery = DB :: $pdo -> querySingle("SELECT COUNT(*) FROM `query_friends` WHERE `id_user` = '".$user['id']."' AND `id_friend` = '".$id."' AND `code` = '".$code."'"); 

	if ($queyFriedQuery > 0) {
		if(DB :: $pdo -> query("DELETE FROM `query_friends` WHERE `id_user` = '".$user['id']."' AND `id_friend` = '".$id."'")) {
			DB :: $pdo -> query("UPDATE `users` SET `count_fr_new`=`count_fr_new`-1 WHERE `id` = ?;", array($user['id']));
	

		}
		system :: redirect("Предложение дружбы отменено!", $link."?id={$user['id']}&tab=3");
	} else { system :: redirect("Предложение дружбы не найдено!", $link."?id={$user['id']}&tab=3", 1); }