<?php

require_once 'incfiles/core.php';
require_once 'incfiles/func.php';
require_once 'incfiles/auth.php';
require_once 'incfiles/user.php';

if (!empty($user_id))
{
	mysql_query("UPDATE `users` SET `online` = 0 WHERE `id` = '".$user_id."' LIMIT 1");
	mysql_query("UPDATE `friends` SET `online` = '".(time()-3600)."' WHERE `friend_id` = '".$user_id."'");

	setcookie("uid", "", time() - 3600, '/');
	setcookie("upass", "", time() - 3600, '/');
	session_destroy();
	unset($user_id);
}

header('location: /'); exit;

?>