% Option Explicit %>
<%
Application.Lock
Dim saryMessages
Dim saryTempArray
Dim intArrayPass
Dim blnAdmin
Dim blnFormatText
strUsername = Session("Username")
blnAdmin = CBool(Session("Admin"))
blnFormatText = CBool(Session("FormatText"))
'If strUsername = "" OR CheckIfBanned(getIP()) Then Response.End
'Get the array
If IsArray(Application(ApplicationMsg)) Then
saryMessages = Application(ApplicationMsg)
Else
ReDim saryMessages(5, 0)
Application(ApplicationMsg) = saryMessages
End If
Dim strMessage
Dim strColor
Dim strFormat
Dim intLastMessageID
Dim intType
Dim strCommand
Dim blnPrivateMessage
Dim saryUserMsgTo
blnPrivateMessage = False
intType = 0
saryUserMsgTo = 0
strMessage = Request.Form("message")
strColor = Request.Form("color")
strFormat = Request.Form("format")
If Mid(strMessage, 1, 1) = "/" Then
If Mid(strMessage, 1, 8) = "/parola " Then
strCommand = Trim(Mid(CleanMessage(strMessage), 8, Len(CleanMessage(strMessage))))
If strCommand = AdminPassword Then
Session("Admin") = True
strMessage = "Admin Giriş Yaptı"
Else
strMessage = "Hata! Yanlış Parola Girdiniz.."
End If
saryUserMsgTo = Array(strUsername)
intType = 1
ElseIf Mid(strMessage, 1, 6) = "/çıkış" Then
Session("Admin") = False
If blnAdmin Then
strMessage = "Çıkış yaptın."
Else
strMessage = "Dikkat! Giriş yapmadın ki çıkış Yapasın Hatası :)"
End If
saryUserMsgTo = Array(strUsername)
intType = 1
ElseIf Mid(strMessage, 1, 7) = "/alert " Then
strCommand = Trim(Mid(strMessage, 7, Len(strMessage)))
If blnAdmin Then
strMessage = "alert('" & strCommand & "');"
saryUserMsgTo = 0
intType = 2
Else
strMessage = "Hata! Bu komutu kullanma yetkiniz yok.."
saryUserMsgTo = Array(strUsername)
intType = 1
End If
ElseIf Mid(strMessage, 1, 8) = "/kickall" Then
If blnAdmin Then
strMessage = "alert('Odadan atıldın!');parent.location=""default.asp"";"
saryUserMsgTo = 0
intType = 2
Else
strMessage = "Hata! Bu komutu kullanma yetkiniz yok.."
saryUserMsgTo = Array(strUsername)
intType = 1
End If
ElseIf Mid(strMessage, 1, 6) = "/kick " Then
strCommand = Trim(Mid(strMessage, 6, Len(strMessage)))
If blnAdmin Then
If KickUser(strCommand) Then
strMessage = strCommand & " odadan atıldı.."
Else
strMessage = strCommand & " diye kullanıcı adı yok.."
End If
saryUserMsgTo = Array(strUsername)
intType = 1
Else
strMessage = "Hata! Bu komutu kullanma yetkiniz yok.."
saryUserMsgTo = Array(strUsername)
intType = 1
End If
ElseIf Mid(strMessage, 1, 5) = "/ban " Then
strCommand = Trim(Mid(strMessage, 5, Len(strMessage)))
If blnAdmin Then
If CheckIfBanned(strCommand) Then
strMessage = strCommand & " is already in the ban list."
Else
Call BanUser(strCommand)
strMessage = strCommand & " has been added to the ban list."
End If
saryUserMsgTo = Array(strUsername)
intType = 1
Else
strMessage = "Hata! Bu komutu kullanma yetkiniz yok.."
saryUserMsgTo = Array(strUsername)
intType = 1
End If
ElseIf Mid(strMessage, 1, 7) = "/unban " Then
strCommand = Trim(Mid(strMessage, 7, Len(strMessage)))
If blnAdmin Then
If CheckIfBanned(strCommand) Then
Call UnBanUser(strCommand)
strMessage = strCommand & " adlı kullanıcı ban listesinden çıkarıldı."
Else
strMessage = strCommand & " adlı kullanıcı ban listesinde değil."
End If
saryUserMsgTo = Array(strUsername)
intType = 1
Else
strMessage = "Hata! Bu komutu kullanma yetkiniz yok.."
saryUserMsgTo = Array(strUsername)
intType = 1
End If
ElseIf Mid(strMessage, 1, 8) = "/banlist" Then
If blnAdmin Then
Dim intBanLoop
saryBanList = GetBanList()
strMessage = "
Ban Listesi (" & UBound(saryBanList) & "):
"
If UBound(saryBanList) = 0 Then
strMessage = strMessage & "No bans."
Else
For intBanLoop = 0 TO UBound(saryBanList) - 1
strMessage = strMessage & saryBanList(intArrayPass) & " - Unban
"
Next
End If
strMessage = strMessage & "
"
saryUserMsgTo = Array(strUsername)
intType = 1
Else
strMessage = "Hata! Bu komutu kullanma yetkiniz yok..."
saryUserMsgTo = Array(strUsername)
intType = 1
End If
ElseIf Mid(strMessage, 1, 6) = "/nick " Then
strCommand = Trim(Mid(strMessage, 6, Len(strMessage)))
Session("Username") = strCommand
strMessage = strUsername & " adını " & strCommand &" olarak değiştirdi"
saryUserMsgTo = 0
intType = 1
ElseIf Mid(strMessage, 1, 7) = "/format" Then
If blnFormatText Then
Session("FormatText") = False
strMessage = "Html temizleme kapalı."
Else
Session("FormatText") = True
strMessage = "Html temizle açık."
End If
saryUserMsgTo = Array(strUsername)
intType = 1
ElseIf Mid(strMessage, 1, 9) = "/yardım" Then
strMessage = "
| Admin Komutları: |
" & _
"| Giriş: | /parola [Parola] |
" & _
"| Çıkış: | /çıkış |
" & _
"| Odadan atma: | /kick [Nick] |
" & _
"| Ban Listesi: | /banlist |
" & _
"| Banlama: | /ban [IP] |
" & _
"| Banlistten çıkarma: | /unban [IP] |
" & _
"| Duyuru: | /alert [Mesaj] |
" & _
" Kullanıcı Komutları: |
" & _
"| Özel Mesaj: | /[Nick] [Mesaj] |
" & _
"| Nick değiştirme: | /nick [Yeni Nick] |
" & _
"| Yazı biçimlendirme açık/kapalı: | /format |
" & _
" Smilies: |
" & _
"" & _
" | :huh? | " & _
" | :s | " & _
" | :P | " & _
" | }:) | " & _
"  | :D | " & _
" | }:| | " & _
" | :) | " & _
" | :oops | " & _
"  | ;) | " & _
" | :pff | " & _
" | :/ | " & _
" | :0 | |
"
saryUserMsgTo = Array(strUsername)
intType = 1
ElseIf Mid(strMessage, 1, 7) = "/color " Then
strCommand = Replace(strMessage, "/color ", "")
Response.Redirect("message.asp?Color=" & strCommand & "&Format=" & strFormat)
Else
'Dim saryActiveUsers
'Dim blnPrivateMessage
blnPrivateMessage = False
'Get the array
If IsArray(Application(ApplicationUsers)) Then
saryActiveUsers = Application(ApplicationUsers)
For intArrayPass = 1 TO UBound(saryActiveUsers, 2)
If Instr(strMessage, "/" & saryActiveUsers(1, intArrayPass) & " ") <> 0 Then
strMessage = Replace(strMessage, "/" & saryActiveUsers(1, intArrayPass) & " ", "")
saryUserMsgTo = Array(saryActiveUsers(1, intArrayPass), strUsername)
intType = 3
blnPrivateMessage = True
Exit For
End If
Next
End If
If blnPrivateMessage = False Then
strMessage = "Yanlış komut yardım için masaj çubuğuna '/yardım' yazınız.."
saryUserMsgTo = Array(strUsername)
intType = 1
End If
End If
Else
If strColor <> "" Then strMessage = "[color=" & strColor & "]" & strMessage & "[/color]"
If strFormat <> "" Then strMessage = "[" & strFormat & "]" & strMessage & "[/" & strFormat & "]"
End If
strMessage = Trim(strMessage)
If strMessage <> "" Then
'Array Legend
'0 = Author
'1 = Message
'2 = Date
'3 = Type
'4 = User ID, 0 = All
'5 = Message ID
Dim intTempSize
intTempSize = UBound(saryMessages, 2)
If intTempSize = 0 Then
intLastMessageID = 0
Else
intLastMessageID = Clng(saryMessages(5, intTempSize))
End If
intTempSize = intTempSize + 1
Response.Write(vbCrLf & intTempSize)
ReDim Preserve saryMessages(5, intTempSize)
saryMessages(0, intTempSize) = strUsername
saryMessages(1, intTempSize) = strMessage
saryMessages(2, intTempSize) = CDbl(Now())
saryMessages(3, intTempSize) = intType
saryMessages(4, intTempSize) = saryUserMsgTo
saryMessages(5, intTempSize) = (intLastMessageID + 1)
Application(ApplicationMsg) = saryMessages
'******************************************
'*** Trim array if over 40 messages ***
'******************************************
If UBound(saryMessages, 2) => 20 Then
'put array in a temp array so we can update it
ReDim saryTempArray(5, 0)
'cut the array in half
For intArrayPass = 10 TO UBound(saryMessages, 2)
ReDim Preserve saryTempArray(5, UBound(saryTempArray, 2) + 1)
saryTempArray(0, UBound(saryTempArray, 2)) = saryMessages(0, intArrayPass)
saryTempArray(1, UBound(saryTempArray, 2)) = saryMessages(1, intArrayPass)
saryTempArray(2, UBound(saryTempArray, 2)) = saryMessages(2, intArrayPass)
saryTempArray(3, UBound(saryTempArray, 2)) = saryMessages(3, intArrayPass)
saryTempArray(4, UBound(saryTempArray, 2)) = saryMessages(4, intArrayPass)
saryTempArray(5, UBound(saryTempArray, 2)) = saryMessages(5, intArrayPass)
Next
'Transfer array to update
saryMessages = saryTempArray
Application(ApplicationMsg) = saryMessages
End If
End If
Application.UnLock
Response.Redirect("message.asp?Color=" & strColor & "&Format=" & strFormat)
Function KickUser(strUsername)
KickUser = False
Dim intArrayPass
Dim saryActiveUsers
Application.Lock
'Get the array
If IsArray(Application(ApplicationUsers)) Then
saryActiveUsers = Application(ApplicationUsers)
Else
ReDim saryActiveUsers(6, 0)
End If
For intArrayPass = 1 TO UBound(saryActiveUsers, 2)
If saryActiveUsers(1, intArrayPass) = strUsername AND saryActiveUsers(3, intArrayPass) <> getIP() Then
saryActiveUsers(6, intArrayPass) = "kick"
KickUser = True
Application(ApplicationUsers) = saryActiveUsers
Exit For
End If
Next
Application.UnLock
End Function
%>