📄 ftpbuy.asp
字号:
<!-- #include file="inc/ftp.asp" -->
<%
Dvbbs.LoadTemplates("usermanager")
Dvbbs.Stats="购买密码方式"
Dvbbs.Nav()
Dvbbs.Head_var 0,0,"FTP服务中心首页","ftpfuwu.asp"
dim membername
membername = Dvbbs.membername
%>
<br>
<table cellpadding=3 cellspacing=1 align=center class=tableborder1>
<tr>
<th width=14% id=tabletitlelink><a href=ftpfuwu.asp>FTP服务中心</a></th>
<th width=14% id=tabletitlelink><a href=ftpgo.asp>购买流量方式</a></th>
<%if UseBuyPassword then%><th width=14% id=tabletitlelink><a href=ftpbuy.asp>购买密码方式</a></th><%end if%>
<%if UseFTPUnion then%><th width=14% id=tabletitlelink><a href=ftpunion.asp>联盟FTP</a></th><%end if%>
<th width=14% id=tabletitlelink><a href=ftpdown.asp>FTP下载必看</a></th>
</tr>
</table>
<br>
<%
If dvbbs.userid=0 Then
Dvbbs.AddErrCode(6)
Else
select case request("action")
case "buypassword"
call buypassword()
case else
call main()
end select
end if
Dvbbs.Stats="plus"
Dvbbs.Showerr()
response.write "<br>"
BBSFTP_Footer
function GetValue(m,p,speed)
dim tm
dim total
dim ret
tm=m/12
total = tm*speed/1024
total = total/1024
total = p*total
ret=cint(total)
if(ret<10) then ret = 10
GetValue=ret
end function
sub main()
dim F_Type,F_typename
dim I_Gold
I_Gold=GetGold()
'---------------------
response.write"<table cellpadding=3 cellspacing=1 align=center class=tableborder1>"&_
"<tr><th colspan=7 height=25 align=center>FTP购买密码方式</th></tr>"&_
"<tr>"&_
"<td align=center width=100% class=tablebody1><b>"&_
"欢迎<font color=red>"& membername &"</font>来到社区服务中心,你现有的现金<font color=blue>$" & I_Gold &"</font>单位,我们将给您提供优质的服务,请选择您的服务项目吧!"&_
"</b></td></tr></table>"
'---------------------
set rs=logconn.execute("SELECT FTPConfig.*, Ftplog_FtpStatistic.State, Ftplog_FtpStatistic.WebClick, Ftplog_FtpStatistic.Seller, Ftplog_FtpStatistic.Flag FROM FTPConfig left JOIN Ftplog_FtpStatistic ON FTPConfig.FTP = Ftplog_FtpStatistic.FTP")
dim m_style
dim m_th
dim m_sec
dim tm_now
tm_now = Now()
dim ftpidx
response.write"<br><table cellpadding=3 cellspacing=1 align=center class=tableborder1>"&_
"<tr><th height=25 width=4% align=center>状态</th><th width=18% align=center>FTP名称</th><th width=7% align=center>单价</th><th width=9% align=center>剩余数量</th><th width=7% align=center>购买量</th><th width=15% align=center>密码更新时间</th><th width=15% align=center>下次更新时间</th><th width=17% align=center>备注</th><th width=8% align=center>操作</th></tr>"
ftpidx = 0
if rs.eof and rs.bof then
response.write"<tr><td class=tablebody1 align=center valign=middle colspan=9>当前没有FTP可供购买密码。</td></tr>"
else
do while not rs.eof
ftpidx = ftpidx +1
m_sec=datediff("s",CDate(tm_now),rs("ExpireTime"))
response.write "<tr><td align=center class=tablebody2>"&rs("state")&"</td>"
response.write "<td align=center valign=middle class=tablebody1>"& replace(rs("FTPName"),vbcrlf,"<br>")&"</td>"
response.write "<td align=center valign=middle class=tablebody2>"& GetValue(m_sec,rs("Value"),rs("UserSpeed")) &" 单位</td>"
m_th=2*rs("MaxUser")-rs("BuyCount")
response.write "<td align=center valign=middle class=tablebody1>"& m_th &"</td>"
response.write "<td align=center valign=middle class=tablebody2>"& rs("BuyCount") &"</td>"
response.write "<td align=center valign=middle class=tablebody1>"& rs("LastUpdatePassWord") &"</td>"
response.write "<td align=center valign=middle class=tablebody2>"& rs("ExpireTime") &"</td>"
response.write "<td align=center valign=middle class=tablebody1>"& "离密码更新还有<font color=red>"& m_sec\3600 &"</font>小时<font color=red>"&(m_sec mod 3600)\60 &"</font>分" &"</td>"
if HasBuy(rs("FTP"),Dvbbs.membername) then
response.write "<form action="""&Dvbbs.ScriptName&"?action=buypassword"" method=post name=ftpgo_chgip"&ftpidx&">"
response.write "<input type=hidden name=ftpid value="&rs("ID")&">"
response.write "<td align=center valign=middle class=tablebody2><input type=submit value=更新IP&查询 name=submit2"&ftpidx&">"
response.write"</td></form>"
else
if m_th>0 then
response.write "<form action="""&Dvbbs.ScriptName&"?action=buypassword"" method=post name=ftpgo_chgip"&ftpidx&">"
response.write "<input type=hidden name=ftpid value="&rs("ID")&">"
response.write "<td align=center valign=middle class=tablebody2><input type=submit value=购买密码 name=submit2"&ftpidx&">"
response.write"</td></form>"
else
response.write "<td align=center valign=middle class=tablebody2>密码已售完 </td>"
end if
end if
response.write "</tr>"
rs.movenext
loop
end if
response.write"</table>"
rs.close
set rs=nothing
end sub
'处理用户购买密码
sub buypassword()
dim cost
dim m_sec
dim FtpName
dim UserSpeed
dim exptime
dim body
dim isbuy
dim id
id = request("ftpid")
if id="" or not isnumeric(id) then
Dvbbs.AddErrCode( "<br><li><b><font color=red>你错误的Ftp!</font></b>" )
exit sub
end if
set rs=logconn.execute("select * from FTPConfig where ID="&request("ftpid"))
if rs.eof then
Dvbbs.AddErrCode( "<br><li><b><font color=red>你错误的Ftp!</font></b>" )
exit sub
end if
UserSpeed=rs("UserSpeed")
exptime=rs("ExpireTime")
FtpName=rs("FTPName")
m_sec=datediff("s",Now(),rs("ExpireTime"))
if UserSpeed=0 then UserSpeed = getlinkspeed(rs("linkname"))
isbuy = HasBuy(rs("ftp"),Dvbbs.membername)
if isbuy then
cost = 0
else
cost = GetValue(m_sec,rs("Value"),UserSpeed)
end if
if(GetGold() < cost) then
Dvbbs.AddErrCode( "<br><li><b><font color=red>你的现金不足!</font></b>" )
exit sub
end if
dvbbs.execute("update [DV_user] set [userWealth]=[userWealth]-"& cost &" where [UserName]='" & Dvbbs.membername & "'")
body = FtpName & vbcrlf & "地址:ftp://" & rs("ftpurl") & vbcrlf &"登录用户名:"&rs("UserName")&vbcrlf&_
"密码:"&rs("PassWord")&vbcrlf&vbcrlf&_
"下载速度:"&UserSpeed&"kbs"&vbcrlf&_
"密码到期时间:"&exptime&vbcrlf&_
"本次交易额:"&cost&"单位"&vbcrlf&_
"登记IP:" & dvbbs.usertrueip
sql="insert into Dv_message(incept,sender,title,content,sendtime,flag,issend) values('"&Dvbbs.membername&"','"&Dvbbs.Forum_info(0)&"','Ftp密码购买单','"&body&"',"&SqlNowString&",0,1)"
Dvbbs.Execute(sql)
UPDATE_User_Msg(Dvbbs.membername)
if isbuy then
sql = "update ftpbuypassword set ip='" & dvbbs.usertrueip& "' where ftp='" & rs("ftp")& "' and username='" &Dvbbs.membername& "'"
else
logconn.execute "update FTPConfig set BuyCount=BuyCount+1 where ID="&request("ftpid")
sql="insert into ftpbuypassword (ftp,username,ip) values('"& rs("ftp") &"','"& Dvbbs.membername &"','"&dvbbs.usertrueip&"')"
end if
logconn.Execute(sql)
if isbuy then
Dvbbs.Dvbbs_Suc("<br>"+"<li><b>更新下载IP成功,查询信息发送成功。<font color=red>请查收你的短信息</font>.")
else
Dvbbs.Dvbbs_Suc("<br>"+"<li><b>购买密码成功。<font color=red>请查收你的短信息</font>.")
end if
end sub
Function newincept(iusername)
dim Yrs
Set Yrs=Dvbbs.execute("Select Count(id) From Dv_Message Where flag=0 and issend=1 and delR=0 And incept='"& iusername &"'")
newincept=Yrs(0)
set Yrs=nothing
if isnull(newincept) then newincept=0
End function
Function update_user_msg(username)
Dim msginfo
if newincept(username)>0 then
msginfo=newincept(username) & "||" & inceptid(1,username) & "||" & inceptid(2,username)
Else
msginfo="0||0||null"
End if
Dvbbs.execute("update [Dv_user] set UserMsg='"&dvbbs.CheckStr(msginfo)&"' where username='"&dvbbs.CheckStr(username)&"'")
End function
Function inceptid(stype,iusername)
dim yrs
Set Yrs=Dvbbs.execute("Select top 1 id,sender From Dv_Message Where flag=0 and issend=1 and delR=0 And incept='"& iusername &"'")
If stype=1 then
inceptid=Yrs(0)
Else
inceptid=Yrs(1)
End if
set Yrs=nothing
End function
function HasBuy(ftpid,username)
HasBuy = false
dim mrs
set mrs=logconn.execute("select * from ftpbuypassword where FTP='"&ftpid&"' and UserName='"&username&"'" )
if not mrs.eof then
HasBuy = True
end if
set mrs = nothing
end function
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -