<?php
	session_start();
	
	header("Content-type: text/html; charset=gb2312"); 
	
	require_once("db/db.php");	
	require_once("common/common.php");
	
	$_SESSION["main_vipnosk"]="";
	$_SESSION["main_vipname"]="";
	$_SESSION["main_vipsex"]="";
	$_SESSION["main_vippswd"]="";
	$_SESSION["main_viptype"]="";
	$_SESSION["main_vipstate"]="";
	$_SESSION["main_viptelno"]="";
	$_SESSION["main_vipborth"]="1900-01-01";
	$_SESSION["main_vipidtype"]="";
	$_SESSION["main_vipidno"]="";
	$_SESSION["main_vipVIPNo"]="";
	$_SESSION["main_vipVIPState"]="";
	$_SESSION["main_viploginedsk"]="0";	//登录成功
	$_SESSION["main_defvipnoflagsk"]="0";
	$_SESSION["main_vipweixinid"]="";	//微信号
					
	$chainno="";
	$userno='000000';	//用户散客微信订房
	$pswd='';
	$userno=strtoupper($userno);
	
	//开始搜索数据库是否可以登录 SELECT convert(varchar(10),getdate(),120)
	$sql = sprintf("SELECT a.VIP_No,a.Sub_No,a.Sub_Name,a.Sub_Sex,a.Sub_Pswd,a.Sub_State,b.VIP_Type,b.VIP_State,a.Sub_TelNo,convert(varchar(10),Sub_Borth,120) as VIPBorth,
					a.Sub_IDType,a.Sub_IDNo FROM VIP_Item a,VIP_Main b WHERE a.VIP_No=b.VIP_No AND (a.Sub_No='%s' or a.Sub_TelNo='%s');",$userno,$userno);
	
	$result = querySql($sql);
	if($row = fetch_array($result))
	{
		//如果有会员号
		//如果密码正确 VIP_No    VIP_State
			//=============================================================//
			$_SESSION["main_vipnosk"]=$row['Sub_No'];
			//$_SESSION["main_vipname"]=$row['Sub_Name'];
			//$_SESSION["main_vipsex"]=$row['Sub_Sex'];
			//$_SESSION["main_vippswd"]=$row['Sub_Pswd'];
			$_SESSION["main_viptype"]=$row['VIP_Type'];
			//$_SESSION["main_vipstate"]=$row['Sub_State'];
			//$_SESSION["main_viptelno"]=$row['Sub_TelNo'];
			//$_SESSION["main_vipborth"]=$row['VIPBorth'];
			//$_SESSION["main_vipidtype"]=$row['Sub_IDType'];
			//$_SESSION["main_vipidno"]=$row['Sub_IDNo'];
			$_SESSION["main_vipVIPNo"]=$row['VIP_No'];
			//$_SESSION["main_vipVIPState"]=$row['VIP_State'];
			$_SESSION["main_viploginedsk"]="1";	//登录成功
			$_SESSION["main_defvipnoflag"]="1";
			//=============================================================//
	}
	//释放数据库
	freeResult($result);
	closeDb();
?>



