<?php
	session_start(); 
	$username=trim($_POST['username']);
	$password=trim($_POST['password']);
	$code=$_SESSION["code"];
	if($_POST['code']=="")
	{
		echo "<script>
						alert('请输入验证码！'); 
						location='lanscend.php';
					</script>";
	}
	if(strtoupper($_POST['code'])!=$_SESSION["code"])
	{
		echo "<script>
						alert('验证码错误！'); 
						location='lanscend.php';
					</script>";
	}
	
	if(empty($username) || empty($password))
	{
		echo 
					"<script>
						alert('您的账号和密码不能为空！'); 
						location='lanscend.php';
					</script>";
	}
  else
  {
  		require_once('inc/conn.php');
		$opendb=new mydb();
		$sqlstr="select * from ls_admin where  adminName='".$username."'";
		
		
		$query1=$opendb->query($sqlstr);
		$rows=mysqli_fetch_assoc($query1);
		$myrows=mysqli_num_rows($query1); 
		if($myrows==0)
		{
			echo "
					<script>
						alert('对不起，没有此用户名！');
						location='lanscend.php';	
					</script>
					";
		}
		if($password!=$rows['adminPwd'])
		{
			echo "
					<script>
						alert('对不起，您的密码有错！');
						location='lanscend.php';	
					</script>
					";
		} 
	else
	{
	
	$_SESSION['inputTimeOut']=time();
		$_SESSION['username']=$username;
		//$_SESSION['password']=$password;
	header("location:lanscendmanage.php");	
	}
	
  }
  
?>