<% Option Explicit %>
<!--#include file="../FS_Inc/Const.asp" -->
<!--#include file="../FS_InterFace/MF_Function.asp" -->
<!--#include file="../FS_Inc/Function.asp" -->
<!--#include file="lib/strlib.asp" -->
<!--#include file="lib/UserCheck.asp" -->
<%
	'得到ISP信息
	dim rs_isp,g_rs
	set rs_isp= Server.CreateObject(G_FS_RS)
	rs_isp.open "select top 1 c_isp,c_user,c_pass,c_url,c_gurl From FS_ME_Pay",User_Conn,1,3
	if rs_isp.eof then
		strShowErr = "<li>找不到系统配置信息，或者没开通在线支付功能。请与系统管理员联系</li>>"
		Response.Redirect("lib/Error.asp?ErrCodes="&Server.URLEncode(strShowErr)&"&ErrorUrl=")
		Response.end
	else
		Dim str_c_isp,str_c_user,str_c_pass,str_c_url,str_c_gurl
		str_c_isp=rs_isp("c_isp")
		str_c_user=rs_isp("c_user")
		str_c_pass=rs_isp("c_pass")
		str_c_url=rs_isp("c_url")
		str_c_gurl=rs_isp("c_gurl")
	end if
if str_c_isp=0 then
%>
<!--#include file="Pay_md5/cncard/MD5.asp" -->
<!--#include file="Pay_md5/cncard/Getdata.asp" -->
<%end if%>
<html xmlns="http://www.w3.org/1999/xhtml">
<title><%=GetUserSystemTitle%>-在线银行支付</title>
<meta name="keywords" content="风讯cms,cms,FoosunCMS,FoosunOA,FoosunVif,vif,风讯网站内容管理系统">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<meta content="MSHTML 6.00.3790.2491" name="GENERATOR" />
<meta name="Keywords" content="Foosun,FoosunCMS,Foosun Inc.,风讯,风讯网站内容管理系统,风讯系统,风讯新闻系统,风讯商城,风讯b2c,新闻系统,CMS,域名空间,asp,jsp,asp.net,SQL,SQL SERVER" />
<link href="images/skin/Css_<%=Request.Cookies("FoosunUserCookies")("UserLogin_Style_Num")%>/<%=Request.Cookies("FoosunUserCookies")("UserLogin_Style_Num")%>.css" rel="stylesheet" type="text/css">
<head>
<body>
<table width="98%" border="0" align="center" cellpadding="1" cellspacing="1" class="table">
  <tr>
    <td>
      <!--#include file="top.asp" -->
    </td>
  </tr>
</table>
<table width="98%" height="135" border="0" align="center" cellpadding="1" cellspacing="1" class="table">
  
    <tr class="back"> 
      <td   colspan="2" class="xingmu" height="26"> <!--#include file="Top_navi.asp" --> </td>
    </tr>
    <tr class="back"> 
      <td width="18%" valign="top" class="hback"> <div align="left"> 
          <!--#include file="menu.asp" -->
        </div></td>
      <td width="82%" valign="top" class="hback"><table width="98%" border="0" align="center" cellpadding="5" cellspacing="1" class="table">
          <tr class="hback"> 
            
          <td class="hback"><strong>位置：</strong><a href="../">网站首页</a> &gt;&gt; 
            <a href="main.asp">会员首页</a> &gt;&gt; 在线银行冲值</td>
          </tr>
        </table>
        <%if Request("action")="submit" then
				Call EndPay()
			 Else
			 	Call PaySelect()
			 End if
		sub PaySelect()
		if trim(Request.Form("GroupID"))<>"" then
			dim GroupMoney_,GroupTF,GroupName_,GroupID_
			set g_rs= Server.CreateObject(G_FS_RS)
			g_rs.open "select GroupID,GroupName,GroupMoney From FS_ME_Group Where GroupID="&clng(NoSqlHack(Request.Form("GroupID"))),User_Conn,1,3
			GroupMoney_=formatNumber(g_rs("GroupMoney"),2,-1)
			GroupTF=1
			GroupID_=g_rs("GroupID")
			g_rs.close:set g_rs=nothing
		else
			GroupMoney_=10
			GroupTF=0
		end if
		
		%>
        
      <table width="98%" border="0" align="center" cellpadding="5" cellspacing="1" class="table">
        <form name="form1" method="post" action="pay.asp?action=submit">
          <tr class="hback"> 
            <td width="15%" height="32" class="hback"> <div align="right">您冲值的金额</div></td>
            <td width="60%" class="hback"><input name="PayMoney" type="text" id="PayMoney" value="<%=GroupMoney_%>">
              人民币 
              <input name="OrderID" type="hidden" id="OrderID" value="<% = NoSqlHack(Request.QueryString("OrderID"))%>"></td>
            <td width="25%" rowspan="3" class="hback"><a href="https://www.cncard.net/merchant.asp?pmid=1008687" target="_blank"><img src="../sys_images/cncard_logo.gif" alt="点击开始注册" width="184" height="40" border="0"></a></td>
          </tr>
          <tr class="hback">
            <td height="32" class="hback"><div align="right">定单号</div></td>
            <td class="hback"><input name="OrderNumber" type="text" id="OrderNumber" value="<%=year(now)&month(now)&day(now)&"-"&GetRamCode(8)%>" readonly="true">
              请记住此定单号，以方便查询</td>
          </tr>
          <tr class="hback"> 
            <td height="32" class="hback"><div align="right">您的支付方式</div></td>
            <td class="hback"><input name="PayIsp" type="radio" value="0" checked>
              云网支付 
              <input name="PayIsp" type="radio" value="1" disabled>
              易宝支付 (需定制) 
              <input type="radio" name="PayIsp" value="2"disabled>
              网银支付(需定制) 
              <input type="radio" name="PayIsp" value="3"disabled>
              支付宝(需定制)<input name="GroupTF" type="hidden" value="<%=GroupTF%>"><input name="GroupID" type="hidden" value="<%=GroupID_%>"></td>
          </tr>
          <tr class="hback"> 
            <td height="32" class="hback">&nbsp;</td>
            <td colspan="2" class="hback"><input type="submit" name="Submit" value="确认支付金额"> 
              <input type="reset" name="Submit2" value=" 重置 "></td>
          </tr>
        </form>
      </table>
		<%
		End sub
		Sub EndPay()
		if trim(Request.Form("PayMoney"))="" or  IsNumeric(trim(Request.Form("PayMoney")))=false then
				strShowErr = "<li>请填写金额</li><li>您输入的金额不合法</li>"
				Response.Redirect("lib/Error.asp?ErrCodes="&Server.URLEncode(strShowErr)&"&ErrorUrl=")
				Response.end
		End if
		if Request.Form("PayIsp") = "" then
				strShowErr = "<li>请选择支付ISP商</li>>"
				Response.Redirect("lib/Error.asp?ErrCodes="&Server.URLEncode(strShowErr)&"&ErrorUrl=")
				Response.end
		End if
		'如果为新购买用户定单号，则把定单数据插入数据库中
		Dim tmp_OrderNumber,tmp_ramcode ,RsOrderObj,tmp_PayMoney,tmp_ymd ,tmp_ymd_ 
		tmp_ramcode = trim(Request.Form("OrderNumber"))
		tmp_PayMoney=NoSqlHack(trim(Request.Form("PayMoney")))
		tmp_ymd=now
		tmp_ymd_=year(tmp_ymd)
		if month(now)<10 then:tmp_ymd_=tmp_ymd_&"0"&month(tmp_ymd):else:tmp_ymd_=tmp_ymd_&month(tmp_ymd):end if
		if day(now)<10 then:tmp_ymd_=tmp_ymd_&"0"&day(tmp_ymd):else:tmp_ymd_=tmp_ymd_&day(tmp_ymd):end if
		Set RsOrderObj = Server.CreateObject(G_FS_RS)
		RsOrderObj.Open "Select * From FS_ME_Order where OrderNumber='"& tmp_ramcode &"'",User_Conn,1,3
		if Not RsOrderObj.eof then
			strShowErr = "<li>定单号意外重复，请重新购买</li>"
			Response.Redirect("lib/Error.asp?ErrCodes="&Server.URLEncode(strShowErr)&"&ErrorUrl=")
			Response.end
			RsOrderObj.update
			RsOrderObj.close:set RsOrderObj = nothing
			set conn=nothing
			set user_conn=nothing
			set fs_user=nothing
		Else
			RsOrderObj.addnew
			RsOrderObj("OrderNumber") = tmp_ramcode
			RsOrderObj("OrderType") = 3
			RsOrderObj("MoneyAmount") = NoSqlHack(trim(Request.Form("PayMoney")))
			RsOrderObj("AddTime") = tmp_ymd
			RsOrderObj("IsSuccess") = 0
			RsOrderObj("isLock") = 0
			RsOrderObj("M_state") = 0
			if trim(Request.Form("GroupTF"))="1" then
				set g_rs= Server.CreateObject(G_FS_RS)
				g_rs.open "select GroupID,GroupName,GroupMoney From FS_ME_Group Where GroupID="&clng(NoSqlHack(Request.Form("GroupID"))),User_Conn,1,3
				RsOrderObj("Content") ="会员续费冲金币,会员组名称:"&g_rs("GroupName")&",GroupId:"&g_rs("GroupID")&""
			else
				RsOrderObj("Content") ="会员直冲金币"
			end if
			RsOrderObj("UserNumber") = Fs_User.UserNumber
			RsOrderObj.update
			RsOrderObj.close:set RsOrderObj = nothing
		End if
		'if str_c_isp=0 then
		'---订单信息---
			Dim c_mid			'商户编号，在申请商户成功后即可获得，可以在申请商户成功的邮件中获取该编号
			Dim c_order			'商户网站生成的订单号，不能重复
			Dim c_name			'商户订单中的收货人姓名
			Dim c_address		'商户订单中的收货人地址
			Dim c_tel			'商户订单中的收货人电话
			Dim c_post			'商户订单中的收货人邮编
			Dim c_email			'商户订单中的收货人Email
			Dim c_orderamount	'商户订单总金额
			Dim c_ymd			'商户订单的产生日期，格式为"yyyymmdd"，如20050102
			Dim c_moneytype		'支付币种，0为人民币
			Dim c_retflag		'商户订单支付成功后是否需要返回商户指定的文件，0：不用返回 1：需要返回
			Dim c_paygate		'如果在商户网站选择银行则设置该值，具体值可参见《云网支付@网技术接口手册》附录一；如果来云网支付@网选择银行此项为空值。
			Dim c_returl		'如果c_retflag为1时，该值代表支付成功后返回的文件的路径
			Dim c_memo1			'商户需要在支付结果通知中转发的商户参数一
			Dim c_memo2			'商户需要在支付结果通知中转发的商户参数二
			Dim c_signstr		'商户对订单信息进行MD5签名后的字符串
			Dim c_pass			'支付密钥，请登录商户管理后台，在帐户信息->基本信息->安全信息中的支付密钥项
			Dim notifytype		'0普通通知方式/1服务器通知方式，空值为普通通知方式
			Dim c_language		'对启用了国际卡支付时，可使用该值定义消费者在银行支付时的页面语种，值为：0银行页面显示为中文/1银行页面显示为英文
			Dim srcStr
			c_mid		= str_c_user
			c_order		= tmp_ramcode
			c_name		= ""
			c_address	= ""
			c_tel		= ""
			c_post		= ""
			c_email		= ""
			c_orderamount	= tmp_PayMoney
			c_ymd		= tmp_ymd_
			c_moneytype	= "0"
			c_retflag	= "1"
			c_paygate	= ""
			c_returl	= str_c_url	'该地址为商户接收云网支付结果通知的页面，请提交完整文件名(对应范例文件：GetPayNotify.asp)
			if trim(Request.Form("GroupID"))<>"" then
			'获得会员组
				c_memo1		= "GroupId_"&g_rs("GroupID")&""
				g_rs.close:set g_rs=nothing
			else
				c_memo1		= "payfor_selfaccount"
			end if
			c_memo2		= "12345"
			c_pass		= str_c_pass
			notifytype	= "0"
			c_language	= "0"
			srcStr = c_mid & c_order & c_orderamount & c_ymd & c_moneytype & c_retflag & c_returl & c_paygate & c_memo1 & c_memo2 & notifytype & c_language & c_pass
			'说明：如果您想指定支付方式(c_paygate)的值时，需要先让用户选择支付方式，然后再根据用户选择的结果在这里进行MD5加密，也就是说，此时，本页面应该拆分为两个页面，分为两个步骤完成。
		'---对订单信息进行MD5加密 
			c_signstr	= MD5(srcStr)  
		'end if 
	%>
        <table width="98%" border="0" align="center" cellpadding="5" cellspacing="1" class="table">
        <form name="payForm1" method="post" action="<% = str_c_gurl%>">
          <tr class="hback"> 
            <td width="24%" height="32" class="hback"> <div align="right">您要冲值为</div></td>
            <td width="76%" class="hback"><input name="PayMoney" type="hidden" id="PayMoney" value="<%=NoSqlHack(trim(Request.Form("PayMoney")))%>">
              <font style="font-size:20px;color:red;"><b><%=NoSqlHack(trim(Request.Form("PayMoney")))%></b></font> 人民币 </td>
          </tr>
          <tr class="hback">
            <td height="32" class="hback"><div align="right">定单号</div></td>
            <td class="hback"><input name="OrderNumber" type="hidden" id="OrderNumber" value="<% = tmp_ramcode%>"><% = tmp_ramcode %></td>
          </tr>
          <tr class="hback"> 
            <td height="32" class="hback"><div align="right">选择的支付提供商</div></td>
            <td class="hback">
			<%
			select case Request.Form("PayIsp")
				case "0"
					response.Write("云网支付")
				case "1"
					response.Write("易宝支付")
				case "2"
					response.Write("网银")
				case "3"
					response.Write("支付宝")
			end select
			%></td>
          </tr>
          <tr class="hback"> 
            <td height="32" class="hback">&nbsp;</td>
            <td class="hback"><input type="submit" name="Submit" value="确认，转到银行选择，开始支付"    onClick="{if(confirm('确认开始支付吗?')){this.document.payForm1.submit();return true;}return false;}">
              <input type="hidden" name="c_mid" value="<%=c_mid%>"> <input type="hidden" name="c_order" value="<%=c_order%>"> 
              <input type="hidden" name="c_name" value="<%=c_name%>"> <input type="hidden" name="c_address" value="<%=c_address%>"> 
              <input type="hidden" name="c_tel" value="<%=c_tel%>"> <input type="hidden" name="c_post" value="<%=c_post%>"> 
              <input type="hidden" name="c_email" value="<%=c_email%>"> <input type="hidden" name="c_orderamount" value="<%=c_orderamount%>"> 
              <input type="hidden" name="c_ymd" value="<%=c_ymd%>"> <input type="hidden" name="c_moneytype" value="<%=c_moneytype%>"> 
              <input type="hidden" name="c_retflag" value="<%=c_retflag%>"> <input type="hidden" name="c_paygate" value="<%=c_paygate%>"> 
              <input type="hidden" name="c_returl" value="<%=c_returl%>"> <input type="hidden" name="c_memo1" value="<%=c_memo1%>"> 
              <input type="hidden" name="c_memo2" value="<%=c_memo2%>"> <input type="hidden" name="c_language" value="<%=c_language%>"> 
              <input type="hidden" name="notifytype" value="<%=notifytype%>"> 
              <input type="hidden" name="c_signstr" value="<%=c_signstr%>">
			  </td>
          </tr>
        </form>
      </table>
		<%End Sub%>
      </td>
    </tr>
    <tr class="back"> 
      <td height="20"  colspan="2" class="xingmu"> <div align="left"> 
          <!--#include file="Copyright.asp" -->
        </div></td>
    </tr>
</table>
</body>
</html>
<%
Set Fs_User = Nothing
%>
<!--Powsered by Foosun Inc.,Product:FoosunCMS V4.0系列-->