<!--#include file="../inc/conn.asp"-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>支付平台 - 用户登录</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<link type="text/css" rel="stylesheet" href="/css/reset.css" />
<link type="text/css" rel="stylesheet" href="/css/main.css" />
<link type="text/css" rel="stylesheet" href="/css/template_home.css" />
<script type="text/javascript" src="/scripts/common.js"></script>
<script type="text/javascript" src="/scripts/default/nav.js"></script>
<script type="text/javascript" src="/scripts/footerdock.js"></script>
<script type="text/javascript" src="js/login.js"></script>
</head>
<body>


<%




Private Function getIP()
	Dim strIPAddr
	If Request.ServerVariables("HTTP_X_FORWARDED_FOR") = "" OR InStr(Request.ServerVariables("HTTP_X_FORWARDED_FOR"), "unknown") > 0 Then
		'strIPAddr = Request.ServerVariables("REMOTE_ADDR")
		strIPAddr = Request.ServerVariables("HTTP_Cdn-Src-Ip")
		If strIPAddr = "" Then strIPAddr = Request.ServerVariables("REMOTE_ADDR")
	ElseIf InStr(Request.ServerVariables("HTTP_X_FORWARDED_FOR"), ",") > 0 Then
		strIPAddr = Mid(Request.ServerVariables("HTTP_X_FORWARDED_FOR"), 1, InStr(Request.ServerVariables("HTTP_X_FORWARDED_FOR"), ",")-1)
	ElseIf InStr(Request.ServerVariables("HTTP_X_FORWARDED_FOR"), ";") > 0 Then
		strIPAddr = Mid(Request.ServerVariables("HTTP_X_FORWARDED_FOR"), 1, InStr(Request.ServerVariables("HTTP_X_FORWARDED_FOR"), ";")-1)
	Else
		strIPAddr = Request.ServerVariables("HTTP_X_FORWARDED_FOR")
	End If
	getIP = Trim(Mid(strIPAddr, 1, 30))
End Function 


if Request.QueryString("trial")="1" then 

		'response.write "<script>alert('后台试用暂停 请返回重新登录');window.location.href='login.asp';</script>"

				'Response.End()

	    	call ConnectionDatabase
			set Rs=GrateRs("select * from member where username like 'trial@6046.com'",3)
			If Not Rs.Eof Then

						Session("Usr_UserName") = rs("username")
						Session("Usr_userid") = rs("id")
						Session("loginip") = rs("ip")
						Session("logdate") = rs("logdate")
						Session("bufa") = rs("bufa")
						rs("logdate")=now()
						rs("ip")=getIP()
						rs.update
						Session("Usr_PassWord") = md5(Rs("passwd"))

			end if


	response.Redirect "/vendor/dashboard.asp"

				Response.End()

end if



Action = UCase(Trim(Request.QueryString("action")))
if Action="LOGIN" then 

dim s_Usr,s_Pwd,s_Chk,ErrStr
ErrStr=""

		If Request.Cookies("err")<>"" Then
			If Int(Request.Cookies("err"))>=5 Then
				response.write "登录失败次数超过5次，1小时内拒绝登录！您的IP已被记录！"
				response.write getIP()
				response.write showCountry(getIP())
				Response.End()
			End If
		End If	


'验证登录用户名密码

	s_Usr = YeSqlStr(ClearSQL(Trim(Request.form("Usr_name"))),0)
	s_Pwd = YeSqlStr(Trim(Request.form("Usr_pass")),0)

		If s_Usr <> "" And s_Pwd <> "" Then
	    	call ConnectionDatabase
			set Rs=GrateRs("select * from member where username like '"&trim(s_Usr)&"'",3)
			If Not Rs.Eof Then
				If Rs("passwd") = md5(s_Pwd) Then
					if rs("vip")=0 then 
						ErrStr="帐户未激活！"
					elseif Rs("state")=0 then
					ErrStr="您的帐户已被锁定,请联系客服!"
					else



						Session("Usr_UserName") = rs("username")
						Session("Usr_userid") = rs("id")
						Session("loginip") = rs("ip")
						Session("logdate") = rs("logdate")
						Session("bufa") = rs("bufa")
						rs("logdate")=now()
						rs("ip")=getIP()
						rs.update
						Session("Usr_PassWord") = md5(s_Pwd)

					end if
				Else

			If Request.Cookies("err")<>"" Then
				Response.Cookies("err")=Request.Cookies("err")+1
			Else
				Response.Cookies("err")=1
			End If
			Response.Cookies("err").Expires=DateAdd("n",60,Now())

					ErrStr="密码不正确!"
				End If
			Else

			If Request.Cookies("err")<>"" Then
				Response.Cookies("err")=Request.Cookies("err")+1
			Else
				Response.Cookies("err")=1
			End If
			Response.Cookies("err").Expires=DateAdd("n",60,Now())

				ErrStr="用户不存在!"
			End If


			call DBConnEnd
		Else
			ErrStr="用户名和密码不能为空!"
		End If
		

'转向
	
	if ErrStr="" then 
	response.Redirect "/vendor/dashboard.asp"
	else
		response.write "<script>alert('"&ErrStr&" 请返回重新登录');window.location.href='login.asp';</script>"
	end if

	end if

%>



<div id="wrap">
	<div id="head">
		<div id="headtitle"><a href="/"><img src="/images/defaultpage/logo.jpg" border="0" alt="" /></a></div>
		<div id="qq"></div>
		<div class="clear"></div>
	</div>
	<ul id="menu">
		<li><a class="menu_current" href="/">首页</a></li>
		<li><a id="menu1" href="/user/Profits.asp">提成比例</a></li>
		<li><a id="menu2" href="/user/startup.asp">注册商户</a></li>
		<li><a href="#">支付演示</a></li>
		<li><a href="#">订单查询</a></li>
	</ul>
	
		<form method="post" action="?action=login" onSubmit="return checkform()" id="ctl01">


			<div style="height:180px"></div>

			<fieldset style=" width:320px; margin:auto; padding-left: 12px">
				<legend class="bigger bold">登录</legend>

				<table cellpadding="5" cellpadding="0" align="center" style="margin:20px 20px 20px 8px" class="fixed">
					<tr>
						<td width="55">通行证</td>
						<td><input name="Usr_name" type="text" maxlength="36" id="Usr_name" class="bigger" title="输入作为通行证的Email地址。" style="width:200px;" /></td>
					</tr>
					<tr>
						<td>密　码</td>
						<td><input name="Usr_pass" type="password" maxlength="35" id="Usr_pass" class="bigger" style="width:200px;" /></td>
					</tr>
					
					<tr>
						<td></td>
						<td height="40"><input type="submit" name="send" value="登录" id="send" class="button" style="height:28px;width:90px;" />
							&nbsp; &nbsp;
							<a href="startup.asp" class="underline">注册通行证</a></td>
					</tr>
					<tr>
						<td></td>
						<td></td>
					</tr>
				</table>
			</fieldset>
		</form>
	
</div>
<div id="footer">
	<div id="copyright">
		 Copyright www-pays.com &copy; 2011 All Rights Reserved.
	</div>
</div>
<script type="text/javascript" src="/scripts/CustomerService.js"></script>
</body>
</html>
