<?php 
session_start();
require_once('../config/config.php');
require_once(CLASS_DIR.'dbClass.php');
mysql_query("UPDATE `mychat_user` SET `status`=0,`session_id`='' WHERE `id`='".$_SESSION['userid']."'");
mysql_query("UPDATE `mychat_user_login_info` SET `logouttime`='".date("Y-m-d H:i:s")."' WHERE `id`='".$_SESSION['loginid']."'");
$_SESSION['username'] = '';
$_SESSION['userid']  = '';

session_destroy();

header("location:index.php?msg=logout");
exit;
?>