if(!isset($user)||!isset($_GET['user_id'])|| $_GET['user_id']==0|| $user['id']== $_GET['user_id']|| $db->query("SELECT * FROM `users` WHERE `id` = '". abs(intval($_GET['user_id']))."'")->rowCount()==0){
header('location: /');
exit;
}
if($db->query("SELECT * FROM `mail_chat` WHERE (`user_id` = '$user[id]' OR `who_id` = '$user[id]') AND (`who_id` = '". abs(intval($_GET['user_id']))."' OR `user_id` = '". abs(intval($_GET['user_id']))."')")->rowCount()==0){
$db->query("INSERT INTO `mail_chat` SET `user_id` = '$user[id]', `who_id` = '". abs(intval($_GET['user_id']))."', `time_last_message` = '". time()."'");