<?php
if($_POST){
	$username = @$_POST['username'];
	$userpass = @$_POST['password'];
	$sql = "SELECT * FROM `".$qz."admin` WHERE `username` = '$username' AND `password` = '".MD5($userpass)."'";
	$result = @mysql_db_query($dbname, $sql, $conn);		//选择数据库并查询
	@mysql_data_seek($result, 0); 	// 定位到第一条记录
	$row=@mysql_fetch_row($result);
	if($row){
		//登录成功
		session_start();
		$_SESSION['username'] = $username;
		header("location:./");
	}else{
		//登录失败
		Msg("登录失败,账号或密码错误!");
	}
	// 释放资源 
	@mysql_free_result($result); 
	// 关闭连接 
	@mysql_close($conn); 
}
?>
<!doctype html>
<html>
<head>
    <meta charset="UTF-8">
    <title>Summor</title>
    <link href="css/admin_login.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div class="admin_login_wrap">
    <h1>后台管理</h1>
    <div class="adming_login_border">
        <div class="admin_input">
            <form action="" method="post">
                <ul class="admin_items">
                    <li>
                        <label for="user">用户名：</label>
                        <input type="text" name="username" value="" id="user" size="40" class="admin_input_style" />
                    </li>
                    <li>
                        <label for="pwd">密码：</label>
                        <input type="password" name="password" value="" id="pwd" size="40" class="admin_input_style" />
                    </li>
                    <li>
                        <input type="submit" tabindex="3" value="提交" class="btn btn-primary" />
                    </li>
                </ul>
            </form>
        </div>
    </div>
    <p class="admin_copyright"><a tabindex="5" href="../">返回首页</a> &copy; 2015 Powered by Summor</p>
</div>
</body>
</html>