<?php
Function chklogin(){
    global $db;
	global $tablepre;
	session_start();
	$uid   = $_SESSION["uid"];
	$uname = $_SESSION["UserName"];
	$pwd   = $_SESSION["pwd"];
    If ($uname!=""){
        $sql="select * from {$tablepre}scuser where UserName='".$uname."' and isCheck=1";
        $row   = $db->get_row($sql);
		if (!empty($row)){
		   $dbpwd=$row["Password"];
		   if ($dbpwd==$pwd){
		      $loginstatus="Y";
		   }
		   else
		   {
		      $loginstatus="N";
		   }
		}
		else{
		   $loginstatus="N";
		  }
	  }
	 else{
	 $loginstatus="N";
	 }
	 return $loginstatus;
}
$loginstatus=chklogin();
if ($loginstatus=="N"){
   header("content-type:text/html; charset=utf-8");
   flc_msg("非法登录或登录超时!","index.php");
   //echo "<br><br><br><br><center>非法登录或登录超时!<a href='../admin.php'>返回</a></center>";
   exit;
}
?>