⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 wygm.asp

📁 本源代码为 网雷弹窗联盟程序的源代码,欢迎大家的下载,学习与交流
💻 ASP
字号:
<html>
<!--#include file="head.asp"-->
<!--#include file="UserSession.asp"-->
<title><%=NetName%> - 购买流量</title>

<body>
<%
if Session("usertype")<>"VIP用户" then
	response.write "<script>alert('发生错误:您不是VIP用户,不能进行流量交易,请申请VIP用户.');window.history.back();</script>"	
	response.end()
end if
%>

<%
if request("BuyId")<>"" then
	BuyId=request("BuyId")
	sql="select * from Business where Id="&BuyId
	rs.open sql,conn,1,3
	if not rs.eof then
		SaleUserId=rs("UserId")
		Quantity=rs("Quantity")
		UnitPriceA=rs("UnitPrice")
		Amount=rs("Amount")
		rs.close
	end if
	
	sql="select [Money],Flag from Users where Id="&Session("Id")
	set rs=conn.execute (sql)
	if not rs.eof then
		if rs("Flag")=2 then
			response.write "<script>alert('发生错误:您的帐号帐号已锁定,请联系站长解决.');window.history.back();</script>"	
			response.end()
		end if
		if CDbl(rs(0))<CDbl(amount) then
			response.write "<script>alert('发生错误:您的帐户余额已不足,不能进行流量交易,请您联系站长充值.');window.history.back();</script>"	
			response.end()
			rs.close
		end if
	end if
	
	'扣除该会员余额,交加上所购买的流量
	conn.execute("Update Users set [Money]=[Money]-"&amount&",RemainPop=RemainPop+"&Quantity&" where Id="&Session("Id"))
	'分配卖方会员所得和网站税收,根据当时的网站税收制度
	WEBSITEM=round(CDbl(amount)*CDbl(Toll/100),2)
	SALEMENBER=round(CDbl(amount)-CDbl(WEBSITEM),2)
	'给卖流量的会员加上应得收入,为去除网站留存部分
	conn.execute("Update Users set [Money]=[Money]+"&SALEMENBER&" where Id="&SaleUserId)
	'修改订单,成为"已成交状态"
	conn.execute("Update Business set TollUserId="&Session("Id")&",TradeState='已成交',ScotAmount="&WEBSITEM&",FactAmount="&SALEMENBER&",BargainTime='"&now()&"' where Id="&BuyId)
	
	Response.Write("<script>alert(""恭喜您,操作成功,请返回后刷新页面"");location.href=""lljy.asp"";</script>")
	Response.End()
end if

if trim(request("action"))="buy" then
	Quantity=trim(request("Quantity"))
	UnitPriceA=request("UnitPrice")
	CheckCode=trim(request("CheckCode"))
	response.write  UnitPriceA
	Amount = CDbl(Quantity)*CDbl(UnitPriceA)/100
	
	if Quantity="" then
		response.write "<script>alert('请输入流量点数');window.history.back();</script>"	
		response.End()
	end if
	if UnitPriceA="" then
		response.write "<script>alert('请输入单价');window.history.back();</script>"	
		response.End()
	end if
	
	if Trim(Request("CheckCode"))="" or isnull(Request("CheckCode")) then
		response.write "<script>alert('请输入附加码');window.history.back();</script>"	
		response.End()
	elseif session("Num")="" then
		response.write "<script>alert('请不要重复提交,如需重新登陆请返回登陆页面');window.history.back();</script>"	
		response.End()
	elseif Trim(Request("CheckCode"))<>session("Num") then
		response.write "<script>alert('你输入的附加码和系统产生的不符');window.history.back();</script>"	
		response.End()
	end if
	'session("Num")=""
	
	sql="select [Money],Flag from Users where Id="&Session("Id")
	set rs=conn.execute (sql)
	if not rs.eof then
		if CDbl(rs(0))<amount then
		if rs("Flag")=2 then
			response.write "<script>alert('发生错误:您的帐号帐号已锁定,请联系站长解决.');window.history.back();</script>"	
			response.end()
		end if
			response.write "<script>alert('发生错误:您的帐户余额已不足,不能进行流量交易,请您联系站长充值.');window.history.back();</script>"	
			response.end()
			rs.close
		end if
	end if

	
	'如果交易控制类型为会员与会员之间的交易.则
	'扣除该会员余额
	conn.execute("Update Users set [Money]=[Money]-"&amount&" where Id="&Session("Id"))
	'添加订单
	sql="insert into Business (TradeType,UserId,Quantity,UnitPrice,Amount,PostTime) values ('购买',"&Session("Id")&","&Quantity&",'"&UnitPriceA&"',"&round(Amount,2)&",'"&now()&"')"

	conn.execute (sql)
	
	'如果交易控制类型为会员与网站之间的交易.则
	Response.Write("<script>alert(""恭喜您,操作成功"");location.href=""lljy.asp"";</script>")
	Response.End()
end if
%>
<!--#include file="toper.asp"-->
<table width="750" height="5" border="0" align="center" cellpadding="0" cellspacing="0">
	<tr>
		<td></td>
	</tr>
</table>
<table width="750" height="5" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td align=left><br>
        <%ShowMenuBuy%>
      <BR></td>
  </tr>
</table>
<table cellspacing="0" cellpadding="0" width="500" align="center" border="0">
自由定价,买卖双方竞价成交。定价的高低直接影响成交速度!	
<form name="f" onSubmit="return checkbuy()" action="wygm.asp?action=buy" method="post">
		<tr>
			<td style="line-height:200%">
			<p><br><br>
			<%
			if session("Errmsg") <> "" then
				response.write "· 在尝试处理您的购买请求时发生了以下错误:<br>"
				response.write "<font color=red>"
				
				response.write session("Errmsg")
				response.write "</font>"
				session("Errmsg") = ""
			end if
			%></p>
			<table cellspacing="0" cellpadding="0">
              <TR>
                <TD width="100" height="24" align="right"><span style="MARGIN: 16px 0px 6px;">点&nbsp; 数</span>:</TD>
                <TD width="200" height="24"><span style="MARGIN: 16px 0px 6px;">
                  <input name="Quantity" size="16" maxlength="20" onKeyUp="value=value.replace(/[^\d]/g,'')"/>
                只能是正整数</span></TD>
                <TD width="10" height="24">&nbsp;</TD>
              </TR>
              <TR>
                <TD width="100" height="24" align="right"><span style="MARGIN: 16px 0px 6px;">出&nbsp; 价</span>:</TD>
                <TD width="400" height="24"><span style="MARGIN: 16px 0px 6px;">
                  <input name="UnitPrice" value="<%=UnitPrice%>" size="16" maxlength="20" <%if AllowHmself=2 then response.write "readonly"%>/>
[分](推荐0.7分,定得太低,难以成交!)</span></TD>
                <TD width="10" height="24">&nbsp;</TD>
              </TR>
              <TR>
                <TD width="100" height="24" align="right"><span style="MARGIN: 16px 0px 6px;">验证码</span>:</TD>
                <TD width="200" height="24"><span style="MARGIN: 16px 0px 6px;">
                  <input size="6" name="CheckCode" />
请输入<img src="GetCode.asp" /></span></TD>
                <TD width="10" height="24"><input type="hidden" name="action" value=1></TD>
              </TR>
              <TR>
                <TD width="100" height="24" align="right">&nbsp;</TD>
                <TD width="200" height="24"><br>
                <input type="submit" value=" 提 交 " name="submit1" /></TD>
                <TD width="10" height="24">&nbsp;</TD>
              </TR>            </table>
			<br />
			<br />
			</p></td>
		</tr>
	</form>
</table>
<table width="750" height="5" border="0" align="center" cellpadding="0" cellspacing="0">
	<tr>
		<td></td>
	</tr>
</table>
<!--#include file="foot.asp"-->

</body>

</html>
<%
Function ShowContent ()
	sql="select wygm from Notice"
	set rs=conn.execute (sql)
	if not rs.eof then
		response.write rs(0)
		rs.close
	end if
End Function
%>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -