<?php
/****************优客365网址导航系统 商业版********************/
/*                                                            */
/*  Youke365.com (C)2017 Youke365 Inc.                        */
/*  This is NOT a freeware, use is subject to license terms   */
/*  优客365网址导航系统是商业软件,使用于商业用途请购买授权    */
/*  V1.0 2017                                                 */
/*  技术支持：1513773524@qq.com                               */
/*  官方网址：http://www.youke365.com                         */
/*  官方论坛：http://bbs.youke365.com                         */                           
/**************************************************************/

require('admin.inc.php');

$table = $DB->table('users');
$user_auth = $_COOKIE['user_auth'];
list($user_id, $user_pass) = $user_auth ? explode('@', authcode($user_auth, 'DECODE')) : array('', '', '');
$user_id = intval($user_id);
$user_pass = addslashes($user_pass);
if (!$user_id || !$user_pass) {
	$user_id = 0;	
	msgbox('您还未登录或无权限！', './login.php');
}

$myself = array();
$user = $DB->fetch_one("SELECT user_id, user_email, user_pass, login_time, login_ip, login_count FROM $table WHERE user_type='admin' AND user_id='$user_id'");
if (!$user) {
	$myself = array();
	setcookie('user_auth', '');
	msgbox('您还未登录或无权限！', './login.php');
} else {
	if ($user['user_pass'] == $user_pass) {
		$myself = array(
	
			'user_id' => $user['user_id'],
			'user_email' => $user['user_email'],
			'login_time' => date('Y-m-d H:i:s', $user['login_time']),
			'login_ip' => long2ip($user['login_ip']),
			'login_count' => $user['login_count'],
		);
	}
}

if (empty($myself)) {
	msgbox('您还未登录或无权限！', './login.php');
}

$smarty->assign('myself', $myself);
?>