?? ftpgo.asp
字號:
<!-- #include file="inc/ftp.asp" -->
<!-- #include file="inc/md5.asp" -->
<%
Dvbbs.LoadTemplates("usermanager")
Dvbbs.Stats="購買流量方式"
Dvbbs.Nav()
Dvbbs.Head_var 0,0,"FTP服務中心首頁","ftpfuwu.asp"
dim membername,ustatus
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 "buysave"
call buysize()
case "chgip"
call chgip()
case "query"
call queryinfo()
case "active"
call active()
case "checkftp"
call checkftp()
case else
call main()
end select
end if
Dvbbs.Stats="plus"
Dvbbs.Showerr()
response.write "<br>"
BBSFTP_Footer
sub main()
dim I_Gold
I_Gold=GetGold()
'---------------------
response.write"<table cellpadding=3 cellspacing=1 align=center class=tableborder1>"&_
"<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 * from FTPConfig")
dim ftpidx
dim mrs,logrs
dim scount,sgb,sseller,stime,sstate
dim starttime,webclick
ftpidx=0
response.write"<br><table cellpadding=3 cellspacing=1 align=center class=tableborder1>"&_
"<tr><th height=25 width=5% align=center>狀態</th><th width=30% align=center>FTP名稱</th><th width=10% align=center>單價</th><th width=8% align=center>點擊次數</th><th width=8% align=center>注冊人數</th><th width=8% align=center>售出流量</th><th width=16% align=center>賣方</th><th width=15% align=center>上架日期</th></tr>"
if rs.eof and rs.bof then
response.write"<tr><td class=tablebody1 align=center valign=middle colspan=7>當前沒有FTP可供購買流量。</td></tr>"
else
do while not rs.eof
set mrs = logconn.execute("select * from FtpLog_FtpStatistic where FTP='"&rs("ftp")&"'")
if mrs.eof then
scount = 0
sgb = 0
sseller = "-"
stime = now
sstate = "-"
else
scount = mrs("WebClick")
sgb = mrs("SelleGB")
stime = mrs("StartTime")
sseller = mrs("Seller")
sstate = mrs("State")
end if
set mrs = nothing
response.write "<tr><td align=center class=tablebody2>"&sstate&"</td>"
response.write "<td align=center valign=middle class=tablebody1><font color=blue><a href='ftpgo.asp?action=checkftp&ftpid="&rs("id")&"'>"& replace(rs("FTPName"),vbcrlf,"<br>")&"</a></font></td>"
response.write "<td align=center valign=middle class=tablebody2>"& rs("Value") &" 單位/"&BuyUnit&"</td>"
response.write "<td align=center valign=middle class=tablebody1>"& scount &"</td>"
set mrs = bbsconn.execute("select count(*) from ftpuserdown where FTP='"&rs("ftp")&"'")
if mrs.eof then
ftpidx = 0
else
ftpidx = mrs(0)
end if
set mrs = nothing
response.write "<td align=center valign=middle class=tablebody2>"& ftpidx &"</td>"
response.write "<td align=center valign=middle class=tablebody1>"& sgb & BuyUnit &"</td>"
response.write "<td align=center valign=middle class=tablebody1>"& sseller &"</td>"
response.write "<td align=center valign=middle class=tablebody2>"& stime &"</td>"
response.write "</tr>"
rs.movenext
loop
end if
rs.close
set rs=nothing
response.write"</table><br>"
end sub
'激活
sub active()
dim ftpid,ftpip
dim upass
upass = ""
ftpid=request("ftpid")
if ftpid="" or not isnumeric(ftpid) then
Dvbbs.AddErrCode("<br><li><b>錯誤的Ftp.")
exit sub
end if
if not ValidUseFtp(dvbbs.userid) then
Dvbbs.AddErrCode("<br><li><b>你沒有使用該項功能的權限.")
exit sub
end if
set rs=logconn.execute("select FTP from FTPConfig where ID="&ftpid)
if rs.bof and rs.eof then
Dvbbs.AddErrCode("<br><li><b>沒有找到指定購買的ftp信息.")
rs.close
set rs=nothing
exit sub
end if
ftpip = rs("ftp")
set rs=nothing
set rs=server.createobject("adodb.recordset")
rs.open "select * from FtpUserDown where UserID=" & dvbbs.userid & " and FTP='" & ftpip & "'",bbsconn,1,3
if rs.eof and rs.bof then
rs.addnew
rs("FTP")=ftpip
rs("UserID")=dvbbs.userid
rs("AllowIP")= "*" 'dvbbs.usertrueIP
rs("MaxDownSize")= 0
rs("LinkName") = GetLinkName(ftpip)
rs("MaxDownSpeed") = GetUserSpeed(dvbbs.userid)
rs("QuotaUsed") = 0
rs("QuotaMax") = 0
if UseDvbbsUserNameAndPassword<>1 then
if request("newpass")<>"" then
rs("UserPassword") = md5(request("newpass"),16)
else
upass = CreateMypass(6)
rs("UserPassword") = md5(upass,16)
end if
rs("UserName") =FtpUserNamePrefix & dvbbs.membername
else
if 1 <> UseDvbbs7Database then
rs("UserPassword") = GetBbsUserPassword(dvbbs.userid)
rs("UserName") = dvbbs.membername
end if
end if
rs("ExpireTime") = dateadd("d",30,Now)
else
rs.close
set rs=nothing
Dvbbs.AddErrCode("<br><li><b><font color=red>你的FTP帳號已經激活過了。</font></b>")
exit sub
end if
rs.update
rs.close
set rs=nothing
if upass<>"" then
Dvbbs.Dvbbs_Suc( "<br>"&"<li><b>帳號激活成功。Ftp帳號密碼為:<font color=blue>"&upass&"</font>。")
else
Dvbbs.Dvbbs_Suc( "<br>"&"<li><b>帳號激活成功。")
end if
end sub
'購買流量
sub buysize()
dim value
dim ftpid,ftpip
dim count
dim cost
count = request("buyvalue")
if count <0 then
Dvbbs.AddErrCode("<br><li><b>購買量不能小于0.")
exit sub
end if
ftpid=request("ftpid")
if ftpid="" or not isnumeric(ftpid) then
Dvbbs.AddErrCode("<br><li><b>沒有找到指定購買的ftp信息1.")
exit sub
end if
if not ValidUseFtp(dvbbs.userid) then
Dvbbs.AddErrCode("<br><li><b>你沒有使用該項功能的權限.")
exit sub
end if
if UseDvbbsUserNameAndPassword<>1 and request("newpass")<>request("newrpass")then
Dvbbs.AddErrCode("<br><li><b>兩次密碼不匹配!")
exit sub
end if
set rs=logconn.execute("select Value,Ftp from FTPConfig where ID="&ftpid)
if rs.bof and rs.eof then
Dvbbs.AddErrCode("<br><li><b>沒有找到指定購買的ftp信息.")
rs.close
set rs=nothing
exit sub
end if
value=rs(0)
ftpip = rs(1)
rs.close
set rs=nothing
if count>0 then
'rem cost = clng(count*value + 0.4) do cast this will cost one more gold each time.
cost = clng(count*value)
if(cost > clng(GetGold())) then
Dvbbs.AddErrCode("<br><li><b><font color=red>你的金錢不夠購買這么多流量.</font>")
exit sub
end if
logconn.execute "update FtpLog_FtpStatistic set SelleGB=SelleGB+"& count &" where FTP='" & ftpip & "'"
else
count = 0
cost = 0
end if
set rs=server.createobject("adodb.recordset")
rs.open "select * from FtpUserDown where UserID=" & dvbbs.userid & " and FTP='" & ftpip & "'",bbsconn,1,3
if rs.eof and rs.bof then
rs.close
set rs=nothing
Dvbbs.AddErrCode("<br><li><b><font color=red>你的FTP帳號還沒有激活,請在FTP服務中心激活帳號先。</font></b>")
exit sub
else
rs("MaxDownSize")=rs("MaxDownSize") + Cdbl(count)*BuyUnitSize
rs("MaxDownSpeed") = GetUserSpeed(dvbbs.userid)
'如果你希望 用戶在購買流量時或者更新信息時自動 更新用戶對應的角色信息,請將下面一行的注釋 ' 去掉。
'rs("LinkName") = GetLinkName(ftpip)
'另外要強調一點,如果這個ftp在聯盟中配置過了別的角色出售,請不要去掉注釋。
rs("AllowIP") = request("allowip")
rs("ExpireTime") = dateadd("d",30,Now)
if UseDvbbsUserNameAndPassword<>1 then
if request("newpass")<>"" then
rs("UserPassword") = md5(request("newpass"),16)
end if
else
if 1 <> UseDvbbs7Database then
rs("UserPassword") = GetBbsUserPassword(dvbbs.userid)
end if
end if
end if
if count>0 then
dvbbs.execute "update [DV_user] set [userWealth]=[userWealth]-"& cost &" where [UserName]='" & dvbbs.membername & "'"
end if
rs.update
rs.close
set rs=nothing
Dvbbs.Dvbbs_Suc( "<br>"+"<li><b>購買成功。本次購買量 <font color=blue>"&count&"</font> "&BuyUnit&",交易金額 <font color=blue>"&cost&"</font> 單位。" )
end sub
sub CheckFtp()
dim I_Gold
dim id,ftpip,i,mrs
dim upspeed,downspeed,sonline
I_Gold=GetGold()
'---------------------
response.write"<table cellpadding=3 cellspacing=1 align=center class=tableborder1>"&_
"<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><br>"
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
ftpip = lcase(rs("ftp"))
I_Gold = rs("value")
if ftpip = "default" then
set mrs=logconn.execute("select count(*) from FTPUserOnline")
else
set mrs=logconn.execute("select count(*) from FTPUserOnline where Ftp='"&ftpip&"'")
end if
sonline = mrs(0)
set mrs = nothing
set mrs=logconn.execute("select * from FtpLog_FtpStatistic where FTP='"&ftpip&"'")
if mrs.eof then
set mrs=nothing
set mrs=server.createobject("adodb.recordset")
mrs.open "select * from FtpLog_FtpStatistic where FTP='"&ftpip&"'",logconn,1,3
mrs.addnew
mrs("StartTime") = Now
mrs("EndTime") = Now
mrs("UpLoadFileSize") = 0
mrs("UpLoadFileCount") = 0
mrs("DownLoadFileSize") = 0
mrs("DownLoadFileCount") = 0
mrs("LoginTimes") = 0
mrs("ConnectionTimes") = 0
mrs("UpTime") = 0
mrs("DownTime") = 0
mrs("SelleGB") = 0
mrs("WebClick") = 1
mrs("Seller") = Dvbbs.Forum_info(0)
mrs("FTP") = ftpip
mrs("State") = "<font color=blue>正常</font>"
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -