<?php
if (empty ( $_SESSION ['username'] ))
	header ( "Location:" . Url ( 'index', 'login' ) );
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta charset="utf-8">
<!-- Title and other stuffs -->
<title><?=$title?></title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="author" content="">
<!-- Stylesheets -->
<link href="View/style/bootstrap.css" rel="stylesheet">
<!-- Font awesome icon -->
<link rel="stylesheet" href="View/style/font-awesome.css">
<!-- jQuery UI -->
<link rel="stylesheet" href="View/style/jquery-ui.css">
<!-- Calendar -->
<link rel="stylesheet" href="View/style/fullcalendar.css">
<!-- prettyPhoto -->
<link rel="stylesheet" href="View/style/prettyPhoto.css">
<!-- Star rating -->
<link rel="stylesheet" href="View/style/rateit.css">
<!-- Main stylesheet -->
<link href="View/style/style.css" rel="stylesheet">
<!-- Widgets stylesheet -->
<link href="View/style/widgets.css" rel="stylesheet">
<script src="View/js/jquery.js"></script>
<!-- jQuery -->
<script type="text/javascript">
$(document).ready(function(){
    $("#submit").click(function(){
        var mail = $("#mail").val(); 
        var key = "mail=" + mail + "&user=<?=$_SESSION['username']?>";
      //  alert(key);
        if(mail==""){ 
            alert("邮箱地址不能为空！");
        } 
      
         $.ajax({
    	   type:"POST",
    	   data:key, 
    	   dataType:"json",
    	   url:'<?=Url('mail_status','sendmail')?>',
           success:function(rdata){
               if(rdata.status=="success"){
                  alert(mail.info);     
                }
            },
            error:function(){
                alert("发送失败");
 	            return false;     
            }        
       });
    });  
});
$(document).ready(function(){
   $("#status").click(function(){
       var mail = $("#mail").val(); 
       var key = $("#verify").val();
       var stat = "mail=" + mail + "&verify=" + key;
      // document.write(key);
       if(mail == ""){ 
           alert("邮箱地址不能为空！");
           return false; 
       } 
       if(key == ""){ 
           alert("验证码不能为空");
           return false; 
       }  
       $.ajax({
          type:"POST", 
          dataType:"json", 
          data:stat, 
          url:"<?=Url('mail_status','mail')?>", 
          success:function(rdata){
              if(rdata.info == "success"){
                 alert(rdata.info);
                }else{
                 alert("验证失败 请重试");
                 return false;
                }
            }
       })
   })
})
</script>
<!-- HTML5 Support for IE -->
<!--[if lt IE 9]>
  <script src="js/html5shim.js"></script>
  <![endif]-->
<!-- Favicon -->
<link rel="shortcut icon" href="img/favicon/favicon.png">
</head>

<body>

	<div class="navbar navbar-fixed-top bs-docs-nav" role="banner">

		<div class="conjtainer">
			<!-- Menu button for smallar screens -->
			<div class="navbar-header">
				<!-- Site name for smallar screens -->
				<a href="index.html" class="navbar-brand hidden-lg">Minecraft玩家用户中心</a>
			</div>
			<!-- Navigation starts -->
			<nav class="collapse navbar-collapse bs-navbar-collapse"
				role="navigation">

				<!-- Links -->
				<ul class="nav navbar-nav pull-right">
					<li class="dropdown pull-right"><a data-toggle="dropdown"
						class="dropdown-toggle" href="#"> <i class="icon-user"></i> Admin
							<b class="caret"></b>
					</a> <!-- Dropdown menu -->
						<ul class="dropdown-menu">
							<li><a href="#"><i class="icon-user"></i> Profile</a></li>
							<li><a href="#"><i class="icon-cogs"></i> Settings</a></li>
							<li><a href="login.html"><i class="icon-off"></i> Logout</a></li>
						</ul></li>
				</ul>
			</nav>
		</div>
	</div>


	<header>
		<div class="container">
			<div class="row">

				<!-- Logo section -->
				<div class="col-md-4">
					<!-- Logo. -->
					<div class="logo">
						<h1>
							<a href="#">Minecraft<span class="bold"></span></a>
						</h1>
						<p class="meta">玩家用户中心</p>
					</div>
					<!-- Logo ends -->
				</div>
			</div>
		</div>
	</header>
	<!-- Header ends -->
	<!-- Main content starts -->
	<div class="content">
		<!-- Sidebar -->
    <?=load("left")?>
    <!-- Sidebar ends -->

		<!-- Main bar -->
		<div class="mainbar">

			<!-- Page heading -->
			<div class="page-head">
				<h2 class="pull-left">
					<i class="icon-list-alt"></i>邮箱验证
				</h2>
				<div class="clearfix"></div>

			</div>
			<!-- Page heading ends -->

			<!-- Matter -->
			<div class="row">

				<div class="col-md-12">

					<div class="widget">
						<div class="widget-content">

							<table class="table table-striped table-bordered table-hover">
								<tbody>
									<tr>
										<td width=78>邮箱地址</td>
										<td><input type="text" id="mail" class="form-control"></td>
										<td><button onclick='' type="button" class="btn btn-danger"
												id="submit">获取验证码</button></td>
									</tr>
									<tr>
										<td>邮箱验证码</td>
										<td><input type="text" id="verify" class="form-control"></td>
										<td><button type="button" class="btn btn-danger" id="status">验证邮箱</button></td>
									</tr>
								</tbody>
							</table>

						</div>
					</div>
				</div>

			</div>
			<!-- Matter ends -->
			<div class="clearfix"></div>

		</div>
	</div>
	<!-- Content ends -->
<?=load("footer")?>