<!DOCTYPE html>
<html>
<head>
<title>登陆界面</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="public/css/style1.css" rel='stylesheet' type='text/css' />
<script type="text/javascript" src="public/js/jquery.js"></script>
<script type="text/javascript" src="public/static/layer/layer.js"></script>
</head>
<body>
	<!--登陆长相部分-->
	<div class="main">
		<div class="login">
			<h1>我的自制微博</h1>
			<div class="inset">
				<!--start-main-->
				<form id="login">
			         <div>
			         	<h2>微博登录</h2>
						<span><label>用户名</label></span>
						<span><input type="text" class="textbox" name="username" ></span>
					 </div>
					 <div> 
						<span><label>密码</label></span>
					    <span><input type="password" class="password" name="password"></span>
					 </div>
					<div class="sign">
                        <input type="submit" value="登录" class="submit" />
					</div>
				</form>
					<div>
						<span style="text-align: right; margin-top: 30px;">没有账号？点击这里
							<a href="register.php">注册</a>
						</span>
					</div>
					
				</div>

		</div>
		<!--//end-main-->
	</div>

<div class="copy-right">
	<p>&copy; 2018 MyWeiBo Login Form. All Rights Reserved</p>

</div>
<div style="text-align:center;">
<p>有关网页：<a href="http://www.baidu.com/" target="_blank">百度</a></p>
</div>
<script>
	//登陆功能部分
    $('#login').click(function(){
        var username  = $("input[name='username']").val();
        var password  = $("input[name='password']").val();
        //js验证用户名和密码是否填写
        if(username == ''){
            layer.msg('请填写用户名');
            return false;
        }
        if(password == ''){
            layer.msg('请填写密码');
            return false;
        }
        //js验证
        //AJAX异步提交账号 jQuery ajax - post() 方法 第一个参数是地址 第二个是东西 第三个是回掉函数
        $.post("ajaxCheckLogin.php", {username: username,password:password}, function(data) {
            if (data == -1) {
                layer.msg('用户名或密码错误');
                return false;
            }
            if (data == 1){
                window.location.href = "setting.php";
            }
        });
        return false;
    });
</script>
</body>
</html>
<?php
	/*2018/2/18*/

  

?>