📄 #my.mo
字号:
lngTotal = (lngRows \ lngSize) + IIf(lngRows Mod lngSize = 0, 0, 1)
If lngTotal < 1 Then lngTotal = 1
If lngId > lngTotal Then lngId = lngTotal
If lngRows = 0 Then
lngMove = 0
lngFlag = 0
ElseIf lngId * lngSize >= lngRows Then
lngMove = IIf(lngRows Mod lngSize = 0, lngSize, lngRows Mod lngSize)
lngFlag = IIf(lngRows Mod lngSize = 0, lngRows - lngSize, lngRows - (lngRows Mod lngSize))
Else
lngMove = lngSize
lngFlag = (lngId - 1) * lngSize
End If
TBBS.Page("id") = lngId
TBBS.Page("rows") = lngRows
TBBS.Page("size") = lngSize
TBBS.Page("total") = lngTotal
TBBS.Page("move") = lngMove
TBBS.Page("flag") = lngFlag
TBBS.Page("datatype") = MyKernel.DB.DataType
TBBS.Page("table") = T_OUTBOX
TBBS.Page("column") = "*"
TBBS.Page("where") = "SENDER='" & SafeString(MyKernel.Memory("username")) & "'"
TBBS.Page("sort") = "SEQID DESC"
TBBS.Page("sorttype") = 1
TBBS.Page("index") = "SEQID"
TBBS.SetPagePrefix "my.asp", Array("handle", "action"), Array("msgbox", "outbox")
TBBS.SetPageXML "smses", "sms", False
End Sub
Private Sub doGetSend()
TBBS.Vars("sendto") = MyIO.QueryString("name")
TBBS.Vars("save") = 0
TBBS.AddNav "", TBBS.Lang("send_sms")
If Not ValidSendto() Then
TBBS.AddError "missing_sendto", Array()
End If
End Sub
Private Function ValidSendto()
If TBBS.Vars("sendto") = "" Then
ValidSendto = True
Exit Function
End If
Dim strSQL
Dim arr
arr = Split(TBBS.Vars("sendto"), ",")
strSQL = "SELECT COUNT(SEQID) FROM $(Table) WHERE USERNAME IN ($(UserName))"
strSQL = Replace(strSQL, "$(Table)", T_USER)
strSQL = Replace(strSQL, "$(UserName)", SafeArray(arr))
ValidSendto = CBool(UBound(arr) + 1 = atol(MyKernel.DB.GetRow(strSQL)))
End Function
Private Sub doGetFile()
TBBS.Vars("type") = atoi(Request.QueryString("type"))
Dim lngId, lngRows, lngSize, lngTotal, lngMove, lngFlag
lngId = atoi(MyIO.QueryString("page"))
If lngId < 1 Then lngId = 1
If InString("1|2|3|4", TBBS.Vars("type"), True) Then
TBBS.AddNav "my.asp?handle=file", TBBS.Lang("my_file")
TBBS.AddNav "", TBBS.Lang("file_" & TBBS.FileTypeName(TBBS.Vars("type")))
lngRows = atol(MyKernel.Memory(TBBS.FileTypeName(TBBS.Vars("type")) & "s"))
Else
TBBS.AddNav "", TBBS.Lang("my_file")
lngRows = atol(MyKernel.Memory("images")) + atol(MyKernel.Memory("rings")) + atol(MyKernel.Memory("videos")) + atol(MyKernel.Memory("softs"))
End If
lngSize = 10
lngTotal = (lngRows \ lngSize) + IIf(lngRows Mod lngSize = 0, 0, 1)
If lngTotal < 1 Then lngTotal = 1
If lngId > lngTotal Then lngId = lngTotal
If lngRows = 0 Then
lngMove = 0
lngFlag = 0
ElseIf lngId * lngSize >= lngRows Then
lngMove = IIf(lngRows Mod lngSize = 0, lngSize, lngRows Mod lngSize)
lngFlag = IIf(lngRows Mod lngSize = 0, lngRows - lngSize, lngRows - (lngRows Mod lngSize))
Else
lngMove = lngSize
lngFlag = (lngId - 1) * lngSize
End If
TBBS.Page("id") = lngId
TBBS.Page("rows") = lngRows
TBBS.Page("size") = lngSize
TBBS.Page("total") = lngTotal
TBBS.Page("move") = lngMove
TBBS.Page("flag") = lngFlag
TBBS.Page("datatype") = MyKernel.DB.DataType
TBBS.Page("table") = T_UPLOAD
TBBS.Page("column") = "*"
If InString("1|2|3|4", TBBS.Vars("type"), True) Then
TBBS.Page("where") = "USERID=" & MyKernel.Memory("seqid") & " AND UPTYPE=" & TBBS.Vars("type")
Else
TBBS.Page("where") = "USERID=" & MyKernel.Memory("seqid")
End If
TBBS.Page("sort") = "SEQID DESC"
TBBS.Page("sorttype") = 1
TBBS.Page("index") = "SEQID"
TBBS.SetPagePrefix "my.asp", Array("handle", "type"), Array("file", TBBS.Vars("type"))
TBBS.SetPageXML "files", "file", False
End Sub
Private Sub doPostMsgbox()
TBBS.AddNav "my.asp?handle=msgbox", TBBS.Lang("my_msgbox")
Select Case TBBS.Vars("action")
Case "send"
Call doPostSend
Case Else
TBBS.AddError "invalid_handle", Array()
End Select
End Sub
Private Sub doPostSend()
TBBS.AddNav "", TBBS.Lang("send_sms")
TBBS.Vars("sendto") = Trim(MyIO.Form("sendto"))
TBBS.Vars("title") = Trim(MyIO.Form("title"))
TBBS.Vars("content") = SafeHTML(MyIO.Form("content"))
TBBS.Vars("save") = MyIO.Form("save")
TBBS.Vars("state") = 1
If Not TBBS.CheckValidate("sms") Then
TBBS.AddHint "invalid_validate", Array()
ElseIf TBBS.Vars("sendto") = "" Then
TBBS.AddHint "empty_sendto", Array()
ElseIf TBBS.Vars("title") = "" Then
TBBS.AddHint "empty_title", Array()
ElseIf Trim(TBBS.Vars("content")) = "" Then
TBBS.AddHint "empty_content", Array()
ElseIf Len(TBBS.Vars("title")) > atol(TBBS.Env("sms_title_max_size")) Then
TBBS.AddHint "sms_title_too_long", Array()
ElseIf Len(TBBS.Vars("content")) > atol(TBBS.Env("sms_content_max_size")) Then
TBBS.AddHint "sms_content_too_long", Array()
ElseIf InString(Replace(TBBS.Vars("sendto"), ",", "|"), MyKernel.Memory("username"), False) Then
TBBS.AddHint "sms_can_not_send_to_self", Array()
ElseIf Not ValidSendto() Then
TBBS.AddHint "missing_sendto", Array()
Else
TBBS.SendMessage MyKernel.Memory("username"), TBBS.Vars("sendto"), TBBS.Vars("title"), TBBS.Vars("content"), CBool(TBBS.Vars("save") = "1")
TBBS.Vars("state") = 2
TBBS.AddHint "sms_send_ok", Array()
End If
Session.Contents.Remove "validate"
End Sub
Private Sub doPostFile()
Select Case TBBS.Vars("action")
Case "del"
Call doPostFileDelete
Case Else
TBBS.AddError "invalid_handle", Array()
End Select
End Sub
Private Sub doPostFileDelete()
Dim arrID, arr, i
Dim strSQL, rs
Dim clsCmd
arrID = MyIO.FormArray("id")
TBBS.Vars("state") = 1
If Not IsArray(arrID) Then
TBBS.AddHint "empty_del_file_list", Array()
ElseIf Not IsNumericArray(arrID) Then
TBBS.AddHint "invalid_del_file", Array()
Else
strSQL = "SELECT UPTYPE,UPPATH FROM $(Table) WHERE USERID=$(UserId) AND SEQID IN ($(SeqId))"
strSQL = Replace(strSQL, "$(Table)", T_UPLOAD)
strSQL = Replace(strSQL, "$(UserId)", MyKernel.Memory("seqid"))
strSQL = Replace(strSQL, "$(SeqId)", Join(arrID, ","))
arr = MyKernel.DB.GetRows(strSQL)
If Not IsArray(arr) Then
TBBS.AddHint "missing_del_file", Array()
Else
For i = 0 To UBound(arr, 2)
Select Case arr(0, i)
Case TBBS_IMAGE
MyKernel.Memory("images") = atol(MyKernel.Memory("images")) - 1
Case TBBS_RING
MyKernel.Memory("rings") = atol(MyKernel.Memory("rings")) - 1
Case TBBS_VIDEO
MyKernel.Memory("videos") = atol(MyKernel.Memory("videos")) - 1
Case TBBS_SOFT
MyKernel.Memory("softs") = atol(MyKernel.Memory("softs")) - 1
End Select
If fso.FileExists(TBBS.MapPath("upload/" & arr(1, i))) Then
fso.DeleteFile TBBS.MapPath("upload/" & arr(1, i))
End If
Next
strSQL = "DELETE FROM $(Table) WHERE USERID=$(UserId) AND SEQID IN ($(SeqId))"
strSQL = Replace(strSQL, "$(Table)", T_UPLOAD)
strSQL = Replace(strSQL, "$(UserId)", MyKernel.Memory("seqid"))
strSQL = Replace(strSQL, "$(SeqId)", Join(arrID, ","))
TBBS.Vars("deletes") = MyKernel.DB.Exec(strSQL)
Set clsCmd = MyKernel.Command(T_USER)
clsCmd.CommandType = "UPDATE"
clsCmd.Where = "SEQID=" & MyKernel.Memory("seqid")
clsCmd.Add "images", MyKernel.Memory("images")
clsCmd.Add "rings", MyKernel.Memory("rings")
clsCmd.Add "videos", MyKernel.Memory("videos")
clsCmd.Add "softs", MyKernel.Memory("softs")
clsCmd.Exec
Set clsCmd = Nothing
TBBS.Vars("state") = 2
TBBS.AddHint "del_file_ok", Array(TBBS.Vars("deletes"))
End If
End If
Call doGetFile
End Sub
Private Sub doPostPasswd()
Dim strOld, arrNew
Dim clsCmd
strOld = Trim(MyIO.Form("old"))
arrNew = MyIO.FormArray("new")
TBBS.Vars("state") = 1
If strOld = "" Then
TBBS.AddHint "empty_old_passwd", Array()
ElseIf Not IsArray(arrNew) Then
TBBS.AddHint "empty_new_passwd", Array()
ElseIf UBound(arrNew) <> 1 Then
TBBS.AddHint "empty_new_passwd", Array()
ElseIf Trim(arrNew(0)) = "" Then
TBBS.AddHint "empty_new_passwd", Array()
ElseIf Trim(arrNew(0)) <> Trim(arrNew(1)) Then
TBBS.AddHint "invalid_new_passwd", Array()
ElseIf strOld = Trim(arrNew(0)) Then
TBBS.AddHint "same_passwd", Array()
ElseIf MD5(strOld) <> MyKernel.Memory("Passwd") Then
TBBS.AddHint "invalid_old_passwd", Array()
Else
MyKernel.Memory("Passwd") = MD5(arrNew(0))
Set clsCmd = MyKernel.Command(T_USER)
clsCmd.CommandType = "UPDATE"
clsCmd.Where = "SEQID=" & MyKernel.Memory("SeqID")
clsCmd.Add "Passwd", MyKernel.Memory("Passwd")
clsCmd.Exec
Set clsCmd = Nothing
TBBS.Vars("state") = 2
TBBS.AddHint "modify_passwd_ok", Array(arrNew(0))
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -