<?php
/*
	[Office 515158] (C) 2009-2014 天生创想 Inc.
	$Id: mod_user mobile $
*/
(!defined('IN_TOA') || !defined('IN_ADMIN')) && exit('Access Denied!');
empty($do) && $do = 'list';
if ($do == 'list') {
	$user = $db->fetch_one_array("SELECT * FROM ".DB_TABLEPRE."user a,".DB_TABLEPRE."user_view b WHERE a.id=b.uid and a.id = '".$_USER->id."'");
	include_once('template/list.php');

}elseif ($do == 'views') {
	$user = $db->fetch_one_array("SELECT * FROM ".DB_TABLEPRE."user a,".DB_TABLEPRE."user_view b WHERE a.id=b.uid and a.id = '".$_USER->id."'");
	include_once('template/views.php');

}elseif ($do == 'pwd') {
	if(getGP('ats','G')=='add'){
		$user = $db->fetch_one_array("SELECT password FROM ".DB_TABLEPRE."user WHERE id = '".$_USER->id."'");
		if(md5(getGP('oldpwd','G'))==$user['password']){
			$user = array(
				'password' => md5(getGP('pwd','G'))
			);
			update_db('user',$user, array('id'=>$id));
			echo '您的密码更新成功，请重新登录！';
		}else{
			echo '输入的旧密码不匹配，请重新输入！';
		}
	}else{
		include_once('template/pwd.php');
	}
}elseif ($do == 'user') {
	$num = $db->result("SELECT COUNT(*) AS num FROM ".DB_TABLEPRE."user a,".DB_TABLEPRE."user_view b WHERE a.id=b.uid order by numbers asc");
	$sql = "SELECT * FROM ".DB_TABLEPRE."user a,".DB_TABLEPRE."user_view b WHERE a.id=b.uid order by numbers asc";
	$result = $db->fetch_all($sql);
	include_once('template/user.php');
}elseif ($do == 'web') {
	$num = $db->result("SELECT COUNT(*) AS num FROM ".DB_TABLEPRE."web WHERE uid='".$_USER->id."' order by id desc");
	$sql = "SELECT * FROM ".DB_TABLEPRE."web WHERE uid='".$_USER->id."' order by id desc";
	$result = $db->fetch_all($sql);
	include_once('template/web.php');
}elseif ($do == 'log') {
	$num = $db->result("SELECT COUNT(*) AS num FROM ".DB_TABLEPRE."loginlog WHERE uid='".$_USER->id."' order by id desc LIMIT 0,100");
	$sql = "SELECT * FROM ".DB_TABLEPRE."loginlog WHERE uid='".$_USER->id."' order by id desc LIMIT 0,100";
	$result = $db->fetch_all($sql);
	include_once('template/log.php');
}
?>