<?php
require("../../class/connect.php");
if(!defined('InEmpireCMS'))
{
	exit();
}
eCheckCloseMods('member');//关闭模块
$myuserid=(int)getcvar('mluserid');
$mhavelogin=0;
if($myuserid)
{
	include("../../class/db_sql.php");
	include("../../member/class/user.php");
	include("../../data/dbcache/MemberLevel.php");
	$link=db_connect();
	$empire=new mysqlquery();
	$mhavelogin=1;
	//数据
	$myusername=RepPostVar(getcvar('mlusername'));
	$myrnd=RepPostVar(getcvar('mlrnd'));
	$r=$empire->fetch1("select ".eReturnSelectMemberF('userid,username,groupid,userfen,money,userdate,havemsg,checked')." from ".eReturnMemberTable()." where ".egetmf('userid')."='$myuserid' and ".egetmf('rnd')."='$myrnd' limit 1");
	if(empty($r[userid])||$r[checked]==0)
	{
		EmptyEcmsCookie();
		$mhavelogin=0;
	}
	//会员等级
	if(empty($r[groupid]))
	{$groupid=eReturnMemberDefGroupid();}
	else
	{$groupid=$r[groupid];}
	$groupname=$level_r[$groupid]['groupname'];
	//点数
	$userfen=$r[userfen];
	//余额
	$money=$r[money];
	//天数
	$userdate=0;
	if($r[userdate])
	{
		$userdate=$r[userdate]-time();
		if($userdate<=0)
		{$userdate=0;}
		else
		{$userdate=round($userdate/(24*3600));}
	}
	//是否有短消息
	$havemsg="";
	if($r[havemsg])
	{
		$havemsg="<a href='".$public_r['newsurl']."e/member/msg/' target=_blank><font color=red>您有新消息</font></a>";
	}
	$addr=$empire->fetch1("select userpic,lasttime from ".eReturnMemberTable()."add where ".egetmf('userid')."='$myuserid' limit 1");
	$userpic=$addr[userpic]?$addr[userpic]:'/e/data/images/nouserpic.gif';
	//$myusername=$r[username];
	$addlast=date("Y年m月d日 H:i",$addr[lasttime]);
	 $nums=$empire->gettotal("select count(*) as total from {$dbtbpre}enewsmember where checked='1'");
	db_close();
	$empire=null;
}
if($mhavelogin==1)
{
?>
<!-- already-login -->
<div class="title"><span>原创作者: <?=$nums?> 人</span>
  <h2>会员中心</h2>
</div>
<div class="userinfo">
	<dl class="lbox_dl">
    	<dt><a href="/e/member/cp/"><img width="52" height="52" src="<?=$userpic?>"></a></dt>
        <dd>
        	<p><strong><?=$r[username]?></strong></p>
            <p><a href="/e/DoInfo/ChangeClass.php?mid=1" class="lgbtn">发表文章</a>&nbsp;&nbsp;<a href="/e/DoInfo/ChangeClass.php?mid=1&classid=3" class="lgbtn">发表日记</a></p>
        </dd>
    </dl>
    <ul class="mylink">
    	<li><a href="/e/space/?userid=<?=$myuserid?>">我的空间</a></li>
        <li><a href="/e/DoInfo/ListInfo.php?mid=1">我的文章</a></li>
        <li><a href="/e/DoInfo/ListInfo.php?mid=1&classid=3">我的日记</a></li>
        <li><a href="/e/member/cp/">会员中心</a></li>
        <li><a href="/e/member/EditInfo/">个人设置</a></li>
        <li><a target="_self" href="/e/member/doaction.php?enews=exit&ecmsfrom=9" onclick="return confirm('确认要退出?');">退出登录</a></li>
    </ul>
    <center>上次登录: <?=$addlast?></center>
</div>
<?
}
else
{

}
?>