<!--#include virtual="/incs/config.asp"-->
<!--#include virtual="/incs/md5.asp"-->
<%
conn.open constr
query = "select * from onlcfg where p_tpe=4"
rs.Open query, conn, 1, 1
If rs.EOF Then
call errorpage(-2,"对不起，系统配置错误！1")
End If
onlpass = Trim(rs("p_pss"))
rs.Close

onlpass=getoutcodelong(onlpass)
if onlpass="" or left(onlpass,6)="10001 " then
call errorpage(-2,"对不起，系统设置错误！2")
end if

%>
<%
	Merchant	=	Request("Merchant")				 
	billno	=	Request("billno")							 
	amount	=	Request("amount")							 
	v_pstring 	=	Request("v_pstring")							 
	SUCCESS	=	Request("SUCCESS")							 
SIGN=request("SIGN")

		m_id		=	Merchant
		m_orderid	= 	billno
		m_oamount	= 	amount
		v_pstring= 	v_pstring
		SIGN		= 	SIGN
		m_status	=	SUCCESS
 	v_oid=m_orderid

md5str=md5(merchant&billno&amount&success&onlpass)

if md5str<>sign then

call errorpage(-2,"对不起，支付认证失败！")
response.end
end if

%>
<% 
payok=false
	if  ucase(SUCCESS)="Y" then
payok=true
v_pstatus=2
else
payok=false
v_pstatus=0
end if
bankname ="ALLBUY"
''''''''''''''''

query = "select * from onlpay where payid=" & v_oid
rs.Open query, conn, 1, 1
If rs.RecordCount <> 1 Then
call errorpage(-2,"对不起，通讯故障，请与本站联系3")
ElseIf rs("v_pstatus") = 2 Then
call errorpage(-2,"对不起，该支付已经结算完毕！4")
End If
rs.Close
query = "update onlpay set  v_pmd5='" & SIGN & "',v_pstatus=" & v_pstatus & ",v_pmode='" & bankname & "',v_pstring='" & v_pstring & "' where  payid=" & v_oid
conn.Execute query, 1, 1
query = "select * from onlpay where payid=" & v_oid
rs.Open query, conn, 1, 1
If rs.RecordCount <> 1 Then
call errorpage(-2,"对不起，通讯故障，请与本站联系！5")
Else
ramount = rs("v_amount")
username = rs("username")
u_name = Trim(rs("v_rname"))
End If
rs.Close

If payok Then
''''''''''''''''''''''''''''''会员入款
query = "update memlst set u_mnyrmn=u_mnyrmn+(" & ramount & "),u_mnyavl=u_mnyavl+(" & ramount & "),u_mnyall=u_mnyall+(" & ramount & ") where  u_nme='"&username&"'"
conn.Execute query, 1, 1
query = "select * from memlst where  u_nme='"&username&"'"
rs.Open query, conn, 1, 1
u_mnyrmn = rs("u_mnyrmn")
u_mnyall = rs("u_mnyall")
u_mnyprz = rs("u_mnyprz")
u_mnybrw = rs("u_mnybrw")
u_mnylck = rs("u_mnylck")
u_mnytmp = rs("u_mnytmp")
u_mnyavl = rs("u_mnyavl")
u_mnyusd = rs("u_mnyusd")
rs.Close
query = "insert into fnclst(f_cid,f_unme,f_pay,f_tpe,f_ttl,f_cnt,f_prd,f_rmn,f_all,f_prz,f_brw,f_lck,f_tmp,f_avl,f_usd,f_yarcnt,f_addtme,f_addunme,f_ok) values('" & v_oid & "','" & username & "'," & ramount & ",1,'网上银行入款','" & bankname & "',''," & u_mnyrmn & "," & u_mnyall & "," & u_mnyprz & "," & u_mnybrw & "," & u_mnylck & "," & u_mnytmp & "," & u_mnyavl & "," & u_mnyusd & ",1,getdate(),'onlinepay',1)"
conn.Execute query, 1, 1
If Err.Number <> 0 Then
call errorpage(-2,"对不起，通讯故障，请与本站联系！6")
Else
payok=true
End If
Else
payok=false
end if  

conn.close

%>

<HTML><HEAD><TITLE><%=pl_stenme%>-银行在线支付</TITLE>
<META http-equiv=Content-Type content="text/html; charset=gb2312">

<STYLE>TD {
	FONT-SIZE: 9pt; LINE-HEIGHT: 14pt
}
</STYLE>

<META content="MSHTML 6.00.2800.1226" name=GENERATOR></HEAD>
<BODY bgColor=#ffffff leftMargin=0 topMargin=0 marginheight="0" marginwidth="0">
<br>
<br>
<br>
<TABLE height=400 cellSpacing=0 cellPadding=0 width=500 
background=../pay_img/cmbchinabg.jpg border=0 align="center" style="border:#000000 1px double">
  <TBODY> 
  <TR>
    <TD vAlign=top>
      <TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
        <TBODY>
        <TR>
          <TD><IMG height=86 src="../pay_img/blank.gif" width=10></TD>
          <TD>&nbsp;</TD></TR>
        <TR>
          <TD width=236><img height=1 src="../pay_img/blank.gif" 
            width=236></TD>
          <TD vAlign=top> 
            <P><% if payok=true then %><font color="#FF0000"><b>恭喜您！</b></font><br>
              <br>
              您所支付的款项：<br>
              <br>
              人民币：<b><font color="#FF0000"><%=getfnc(ramount)%></font>元</b><br>
              <br>
              已经成功转到您的会员号下！<br>
			  <% else %>
              <font color="#FF0000"><b><font color="#0000FF">对不起！</font></b></font><br>
              <br>
              您所支付的款项：<br>
              <br>
              人民币：<b><font color="#FF0000"><%=getfnc(ramount)%></font>元</b><br>
              <br>
              因操作失败未能转到您的会员号下！ 
			  <% end if %></P>
	 <P>&nbsp;</P></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE></BODY></HTML>
