<!--#include file="../../inc/payconn.asp"-->
<!-- #include file="asp_md5.asp" -->
<%

	mysp_billno = ClearSQL(request("num"))
	MyPrice = ClearSQL(request("price"))
	PayID = ClearSQL(Request("PayID"))

	ka_type1 = ClearSQL(Request("ka_type"))
	ka_number1 = ClearSQL(Request("ka_number"))
	ka_password1 = ClearSQL(Request("ka_password"))
	

	If PayID = "" or MyPrice="" or mysp_billno="" Then
		Response.Write("缺少参数！")
		Response.End()
	End If



SQL = "Select * From [L_pay] Where ptype='15173'"
Call ConnectionDatabase()
Set crs = Server.CreateObject("ADODB.Recordset")
crs.Open SQL,Conn,1,1
if crs.eof Then
 Response.Write "支付未设置！"
 Response.End()
End If

	Dim prs

	Set prs = Conn.Execute("Select psort,wangguan From [H_Plist] Where ID="&Cint(PayID))
	if prs.Eof Then
		Response.Write("找不到支付方式！")
		Response.End()
	Else
		psort = prs("psort")
		mypaytype = prs("wangguan")
	End If


	Dim request_text
	Dim md5_sign

	spid		= crs("sId")                                       ' 这里替换为您的实际商户号
	sp_key	= crs("sKey")				' 商户密钥,测试时即为商户号,正式上线后需修改	
		

	bargainor_id = spid					' 商户号
	sp_billno	 = mysp_billno		' 商户生成的订单号
	
	pay_type = mypaytype	
	total_fee		 = myprice         	' 支付金额
	
	return_url = "http://"&Request.ServerVariables("SERVER_NAME")&"/Pay/15173/result.asp"
	select_url = "http://"&Request.ServerVariables("SERVER_NAME")&"/Pay/15173/result.asp"
	attach		 = "15173"	' 商户私有数据, 请求回调页面时原样返回
	zidy_cod	 = "15173" ' 商户私有数据, 请求回调页面时原样返回


	


	' 生成MD5签名    
	sign_text = "bargainor_id=" & bargainor_id & "&sp_billno=" & sp_billno & "&pay_type=" & pay_type &_
        "&return_url=" & return_url & "&attach=" & attach & "&key=" & sp_key

  md5_sign = UCase(ASP_MD5(sign_text))        ' 转换为大写
  

'15173-1	上海市 世纪互联
  'url = "http://211.152.32.90/Pay_digate.aspx"

'15173-2	上海市 电信(外高桥)IDC机房
  url = "http://222.73.18.150/Pay_digate.aspx"

'15173-3	海市 电信(外高桥)IDC机房
  'url = "http://222.73.15.107/Pay_digate.aspx"

'15173-4	上海市 世纪互联
  'url = "http://211.152.53.139/Pay_digate.aspx"

'15173-5	上海市 世纪互联
  'url = "http://203.166.160.160/Pay_digate.aspx"

  
  gourl = url&"?bargainor_id="&bargainor_id&"&sp_billno="&sp_billno&"&pay_type="&pay_type&"&return_url="&return_url&"&attach="&attach&"&total_fee="&total_fee&"&select_url="&select_url&"&zidy_cod="&zidy_cod&"&ka_type1="&ka_type1&"&ka_number1="&ka_number1&"&ka_password1="&ka_password1&"&sign="&md5_sign

	set objHttp = Server.CreateObject("MSXML2.ServerXMLHTTP")
 	sFormString = "bargainor_id="&bargainor_id&"&sp_billno="&sp_billno&"&pay_type="&pay_type&"&return_url="&return_url&"&attach="&attach&"&total_fee="&total_fee&"&select_url="&select_url&"&zidy_cod="&zidy_cod&"&ka_type1="&ka_type1&"&ka_number1="&ka_number1&"&ka_password1="&ka_password1&"&sign="&md5_sign
	objHttp.open "POST", url, false
	objHttp.setRequestHeader "Content-type", "application/x-www-form-urlencoded"
	objHttp.Send sFormString
	If (objHttp.status <> 200 ) Then
		response.Write("通信失败！")
	Else
		Response.Write(objHttp.responseText)
	End If


  'Response.Redirect(gourl)

%>
