<?php
if (empty ( $_SESSION ['username'] ))
	header ( "Location:" . Url ( 'index', 'login' ) );
?>
<!DOCTYPE html>
<html>
<head>
<title><?=$title?></title>
<meta http-equiv="X-UA-Compatible" content="IE=edge,Chrome=1" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />

<!-- bootstrap -->
<link href="View/public/css/bootstrap/bootstrap.css" rel="stylesheet" />
<link href="View/public/css/bootstrap/bootstrap-responsive.css"
	rel="stylesheet" />
<link href="View/public/css/bootstrap/bootstrap-overrides.css"
	type="text/css" rel="stylesheet" />

<!-- global styles -->
<link rel="stylesheet" type="text/css" href="View/public/css/layout.css" />
<link rel="stylesheet" type="text/css"
	href="View/public/css/elements.css" />
<link rel="stylesheet" type="text/css" href="View/public/css/icons.css" />

<!-- libraries -->
<link rel="stylesheet" type="text/css"
	href="View/public/css/lib/font-awesome.css" />

<!-- this page specific styles -->
<link rel="stylesheet" href="View/public/css/compiled/personal-info.css"
	type="text/css" media="screen" />

<!-- open sans font -->
<link
	href='http://fonts.useso.com/css?family=Open+Sans:300italic,400italic,600italic,700italic,800italic,400,300,600,700,800'
	rel='stylesheet' type='text/css' />

<!--[if lt IE 9]>
      <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
    <![endif]-->
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>
<body>

	<!-- navbar -->
	<div class="navbar navbar-inverse">
		<div class="navbar-inner">
			<a class="brand" href="index.php"><img src="img/logo.png" /></a>
			<button type="button" class="btn btn-navbar" data-toggle="collapse"
				data-target=".nav-collapse">
				<span class="icon-bar"></span> <span class="icon-bar"></span> <span
					class="icon-bar"></span>
			</button>
			<div class="nav-collapse collapse">
				<ul class="nav">

					<li class="active"><a href="index.php"> <i class="icon-home"></i> <span>首页</span>
					</a></li>

					<li><a href="<?=Url('index' , 'pass')?>"> <i class="icon-group"></i>
							<span>修改密码</span>
					</a></li>
					<li><a href="<?=Url('index','mail')?>"> <i class="icon-picture"></i>
							<span>验证邮箱</span>
					</a></li>
				</ul>
				<ul class="nav pull-right">
					<li class="dropdown"><a href="#"
						class="dropdown-toggle hidden-phone" data-toggle="dropdown">
                        已登陆玩家:<?=$_SESSION['username']?>
                        <b class="caret"></b>
					</a>
						<ul class="dropdown-menu">
							<li><a href="<?=Url('user_public','logout')?>"><i
									class="icon-off"></i> 退出</a></li>
						</ul></li>
				</ul>
			</div>
		</div>
	</div>
	<!-- end navbar -->

	<!-- main container .wide-content is used for this layout without sidebar :)  -->
	<div class="content wide-content col-xs-12 col-md-12 col-lg-12">
		<div class="container-fluid">
			<div class="settings-wrapper" id="pad-wrapper">
				<!-- avatar column -->
				<div class="span3 avatar-box">
					<div class="personal-image">
						<img src="View/public/tx.jpg" class="avatar img-circle" />
					</div>
				</div>

				<!-- edit form column -->
				<div class="span7 personal-info">
					<h5 class="personal-title">Minecraft玩家信息</h5>

					<form>
					<div class="field-box">
						<label>游戏帐号:</label> <input class="span5 inline-input" id="user"
							type="text" value="<?=$_SESSION['username']?>"
							disabled="disabled" />
					</div>
					<div class="field-box">
						<label>邮箱地址:</label> <input class="span5 inline-input" id="mail"
							type="text" value="" disabled="disabled" />
					</div>
					<div class="field-box">
						<label>游戏币余额:</label> <input class="span5 inline-input" id="money"
							type="text" value="" disabled="disabled" />
					</div>
					</form>
				</div>
			</div>
		</div>
	</div>
	<!-- end main container -->


	<!-- scripts -->
	<script src="View/public/js/jquery-latest.js"></script>
	<script src="View/public/js/bootstrap.min.js"></script>
	<script src="View/public/js/theme.js"></script>
	<script type="text/javascript">
    select();
    status();

    var data = "user=<?=$_SESSION['username']?>";
    function select(){
        $.ajax({
            type:"GET",
            dataType:"json",
            data:data,
            url:"<?=Url('mail_status', "select")?>",
            success:function(rdata){
                  $.each(rdata.info,function(index,content)
                  {
                      if(rdata.status == "success")
                      {
                    	 $("#mail").val(content.email);
                      }
                  }              
               )},
            error:function(){
                  alert("数据读取失败");
                  return false;
               }
        }); 
    }
    function status(){
        $.ajax({
            type:"GET", 
            dataType:"json",
            data:data,
            url:"<?=Url('mail_status', "stat")?>",
            success:function(data){
                  $.each(data.info,function(index,content)
                  {
                     if(content.statu == 0)
                      {
                          $("#status").html("邮箱验证状态:尚未验证");
                      }else{
                          $('#status').html("邮箱验证状态:已验证");
                      }  
                  })       	
               },
            error:function(){
                alert("邮箱验证状态读取失败");
                return false;
               }   
           })	
        }
    window.onload = function(){
    	var html = $('.status').html();
    	//document.write(html);
    	  if(html.indexOf("尚未验证") !== -1){
                $('.status').html($('.status').html()+ "  <a href='<?=Url('index', 'mail')?>' onclick='display()'>点击这里进行验证</a>")
           }
    }
    current();
    function current(){
    	 $.ajax({
    		 type:"GET", 
    		 dataType:"json", 
    		 data:{user:"<?=$_SESSION['username']?>"}, 
    		 url:"<?=Url('user_current' , 'current')?>",
    		 success:function(rdata){
                 $.each(rdata.info,function(index,content)
                         {
                             if(rdata.status == "success")
                             {
                           	  $("#money").val( content.balance ); 
                             }
                         })
    		   },
    		 error:function(){
    			 alert("尚未查询到此用户的游戏币余额");
    		   }  
         })
    }
    </script>

</body>
</html>