<?php 
$sj=date('Y-m-d H:i:s');
//获取推荐人信息
if($_SESSION["tjr"]==NULL)
{
	$_SESSION["tjr"]=$_GET["rec"]; 
}
//判断是否二级页面
$navheadurl="";
if($tag=="center"||$tag=="fxb"||$tag=="cha"){
  $navheadurl="../";
}
$hcookieusername = $_COOKIE['ddusername']; 
$hcookiepassword = $_COOKIE['ddpassword']; $hnum=0;
if($hcookieusername<>NULL&&$_SESSION["duoduouser"]==NULL)
{	
	$hq = "SELECT * FROM ".$BIAOTOU."user where ddusername='".$hcookieusername."' and ddpassword='".$hcookiepassword."'";
	$hrs = mysql_query($hq);
	$hnum = mysql_num_rows($hrs);
	
	if($hnum!=0)
	{   
		while($row = mysql_fetch_object($hrs)) 
		{
			$_SESSION["dduserid"] = $row->Id;
			$_SESSION["dduserlevel"] = $row->dengji; 
		} 		
		$hsj= date("Y-m-d H:i:s");
		$hq = "update ".$BIAOTOU."user set loginnum=loginnum+1 ,lastlogintime='$sj' where ddusername='".$hcookieusername."'";	
		mysql_query($hq);
		$_SESSION["duoduouser"] = $hcookieusername; 			 
	}
}

if($_SESSION["duoduouser"]!=NULL){
	$sql="select * from ".$BIAOTOU."user where ddusername='".$_SESSION["duoduouser"]."'";
	$urs = mysql_query($sql);
	while($urow = mysql_fetch_object($urs)) 
	{
		$money=round($urow->money,2); 
		if($money<0)
			$money=0;
		$dengji=$urow->dengji; 
		$_SESSION["dduserlevel"] = $dengji; 
		$txsj=$urow->lasttixian; 
		$txstate=$urow->txstate;
		$jifen=$urow->jifen;
	}

	mysql_query("set names utf8");	
	$hsql="select id from ".$BIAOTOU."msg where ddusername='".$_SESSION["duoduouser"]."' and see=0";
	$hrs = mysql_query($hsql);
	$msgnum = mysql_num_rows($hrs);
	
	if($msgnum==0)
	{ $msgsrc="<img src=\"".$navheadurl."template/".MOBAN."/images/msg-read.gif\" border=\"0\" alt=\"短消息\" />";}
	else
	{$msgsrc="<img src=\"".$navheadurl."template/".MOBAN."/images/msg.gif\" border=\"0\" alt=\"您有新的短消息\" />";}
}
?>
<div id="header">
<div style="width:960px; height:auto; margin:0 auto;">
	<span class="header_left"><a href="<?php echo $navheadurl ?>"><?php echo WEBNICK?>首页</a>&nbsp;&nbsp;&nbsp;&nbsp;|&nbsp;&nbsp;&nbsp;&nbsp;<a href="#dd" onclick="AddFavorite('<?=$navheadurl?>','<?=WEBNICK?>')">收藏本站</a>&nbsp;&nbsp;&nbsp;&nbsp;|&nbsp;&nbsp;&nbsp;&nbsp;<a href="<?=$navheadurl?>comm/shortcut.php">快捷桌面</a> 
	&nbsp;&nbsp;&nbsp;&nbsp;|&nbsp;&nbsp;&nbsp;&nbsp;<a href="<?=$navheadurl?>sitemap.php" >淘宝分类</a> 
	<?php if(CHA=='1'){?>&nbsp;&nbsp;&nbsp;&nbsp;|&nbsp;&nbsp;&nbsp;&nbsp;<a href="<?=$navheadurl?>cha" >测试返现</a><?php }?>
    <?php if(FXBOPEN=='1'){?>&nbsp;&nbsp;&nbsp;&nbsp;|&nbsp;&nbsp;&nbsp;&nbsp;<a href="<?=$navheadurl?>fanxianbao" >返现宝</a><?php }?> 
    </span>
	<span class="header_right"><?php 
		if($_SESSION["duoduouser"]!=NULL)
		{
			echo "&nbsp;&nbsp;&nbsp;&nbsp;<a href=\"".$navheadurl."user/center.php\">账户：".$_SESSION["duoduouser"]."</a> <a href=\"".$navheadurl."user/msg_list.php?act=in\">".$msgsrc."</a>&nbsp;&nbsp;&nbsp;&nbsp;<a href=\"".$navheadurl."user/mingxilist.php?act=in\">账户余额：".$money." <img src=\"".$navheadurl."template/".MOBAN."/images/money2.gif\" border=\"0\"  alt=\"账户明细\" /></a>&nbsp;&nbsp;&nbsp;&nbsp;|&nbsp;&nbsp;&nbsp;&nbsp;<a href=\"".$navheadurl."user/exit.php\">退出</a>";
		}
		else
		{
			echo "&nbsp;&nbsp;&nbsp;&nbsp;<a href=\"".$navheadurl."user/register.php\">注册</a>&nbsp;&nbsp;&nbsp;&nbsp;|&nbsp;&nbsp;&nbsp;&nbsp;<a href=\"".$navheadurl."user/login.php\">登录</a>&nbsp;&nbsp;&nbsp;&nbsp;|&nbsp;&nbsp;&nbsp;&nbsp;<a href=\"".$navheadurl."user/getpassword.php\">找回密码</a>";
		}
	?></span></div>
</div>
