% Response.Buffer = True %>
<%
strMode = Request("mode")
strMsg = Request("msg")
If strMode = "chat" Then
%><%
ElseIf strMode = "signup" Then
strSMode = LCase(Request("smode"))
If strSMode = "" Then
%><%
ElseIf strSMode = "save" Then
strUsername = LCase(Request("username"))
strPass1 = LCase(Request("pass"))
strPass2 = LCase(Request("cpass"))
strEmail = LCase(Request("email"))
If strPass1 = strPass2 Then
Set Conn = Server.CreateObject("ADODB.Connection")
Set Rs = Server.CreateObject("ADODB.Recordset")
Conn.Open strSystemDSN
strSQL = "SELECT * FROM users WHERE username='" & strUsername & "';"
Set Rs = Conn.Execute(strSQL)
intIsRegd = Not Rs.BOF
Set Rs = Nothing
Conn.Close: Set Conn = Nothing
If intIsRegd = 0 Then
ExecuteSQL "system.mdb", "INSERT INTO users (username,password,email) VALUES ('" & strUsername & "','" & strPass1 & "','" & strEmail & "');"
ExecuteSQL "mails.mdb", "INSERT INTO folders (owner, name) VALUES ('" & strUsername & "','Inbox');"
%><%
Else
%><%
End If
End If
End If
ElseIf strMode = "login" Then
Set Conn = Server.CreateObject("ADODB.Connection")
Set Rs = Server.CreateObject("ADODB.Recordset")
Conn.Open strSystemDSN
strSQL = "SELECT * FROM bans WHERE username='" & strUsername & "' OR ip='" & Request.ServerVariables("REMOTE_ADDR") & "';"
Set Rs = Conn.Execute(strSQL)
intBanned = Abs(Not Rs.BOF)
For intIndex = 1 To intSYS_MaxUsers
If Application(strUser & intIndex) ="" Then bolFreeUser = True
Next
If intBanned = 0 And bolFreeUser = True Then
strSQL = "SELECT * FROM rooms WHERE lcase(roomname)='" & LCase(strRoom) & "';"
Set Rs = Conn.Execute(strSQL)
intLineBuffer = C(Rs("LineBuffer"))
If Len(strPassword) = 0 Then
strSQL = "SELECT * FROM users WHERE username='" & strUsername & "';"
Set Rs = Conn.Execute(strSQL): intValid = (Rs.BOF And Rs.EOF)
Set Rs = Nothing
Conn.Close: Set Conn = Nothing
strEmail = ""
strColor = "#000000"
intItali = 0
intUnder = 0
intLevel = 0
Response.Cookies("easychat")("tip") = "Velkommen til " & strSYS_Name & "! Se efter tips her!"
Else
strSQL = "SELECT * FROM users WHERE username='" & strUsername & "' AND password='" & strPassword & "';"
Set Rs = Conn.Execute(strSQL)
intValid = (Not Rs.Bof And Not Rs.Eof)
If intValid = True Then
intIsAdmin = True
strEmail = Rs("email")
strColor = Rs("color")
intItali = C(Rs("italic"))
intUnder = C(Rs("underline"))
intLevel = C(Rs("userlevel"))
Conn.Close
Conn.Open strMailDSN
strSQL = "SELECT COUNT(*) AS total FROM mails WHERE to='" & strUsername & "' AND read=0;"
Set Rs = Conn.Execute(strSQL): intCount = C(Rs("total"))
Set Rs = Nothing: Conn.Close
Set Conn = Nothing
Select Case intCount > 0
Case True: Response.Cookies("easychat")("tip") = "Du har " & intCount & " nye besked(er)! Klik på 'iMail' knappen for at læse dem!"
Case False: Response.Cookies("easychat")("tip") = "Velkommen " & strSYS_Name & "! Se efter tips her!"
End Select
End If
End If
If intValid = True Then
For intIndex = 1 To intSYS_MaxUsers
If strUsername = Application(strUser & intIndex) Then bolUserExist = True
Next
If bolUserExist = 0 Or intIsAdmin = True Then
intSave = C(Request("save"))
If intSave = 1 Then
Response.Cookies("ezchat")("username") = strUsername
Response.Cookies("ezchat")("password") = strPassword
Response.Cookies("ezchat")("save") = "save"
Response.Cookies("ezchat")("room") = strRoom
Response.Cookies("ezchat").Expires = DateAdd("yyyy", 1, Now)
Else
Response.Cookies("ezchat")("save") = ""
Response.Cookies("ezchat").Expires = "01/19/1982 00:00:00"
End If
strNow = Now
ExecuteSQL "system.mdb", "INSERT INTO log VALUES ('" & strUsername & "',#" & strNow & "#,'" & Request.ServerVariables("REMOTE_ADDR") & "','" & strRoom & "');"
ExecuteSQL "system.mdb", "UPDATE users SET lastonline=#" & strNow & "#, lastroom='" & strRoom & "' WHERE username='" & strUsername & "';"
strLCUser = strUsername
Response.Cookies("easychat")("username") = strUsername
Response.Cookies("easychat")("custom") = strColor
Response.Cookies("easychat")("room") = strRoom
Response.Cookies("easychat")("italics") = intItali
Response.Cookies("easychat")("underline") = intUnder
Application(strLCUser & "_now") = strNow
Application(strLCUser & "_regged") = Abs(intIsAdmin)
Application(strLCUser & "_admin") = intLevel
Application(strLCUser & "_away") = "0"
Application(strLCUser & "_email") = strEmail
Application(strLCUser & "_dt") = DateAdd("n", intSYS_ATimeOut, Now)
Application(strLCUser & "_ip") = Request.ServerVariables("REMOTE_ADDR")
Application(strRoom & "_lines") = intLineBuffer
Response.Cookies("easychat").Expires = DateAdd("d", 10, Date)
RemoveKick strUsername
InsertLine "/login " & strUsername & " " & strNow, strNow
If bolUserExist = 0 Then
Application.Lock
For intIndex = 30 To 2 Step True
Application(strUser & intIndex) = Application(strUser & intIndex - 1)
Next
Application(strUser & "1") = strUsername
Application.UnLock
End If
%><%
Else
strErrorMessage = "Du kan ikke logge ind med det valgte brugernavn! Det er allerede i brug!"
End If
Else
Select Case Len(strPassword) > 0
Case True: strErrorMessage = "Forkert brugernavn eller password!"
Case False: strErrorMessage = "Det valgte brugernavn er reserveret af en registreret bruger!"
End Select
End If
Else
Select Case bolFreeUser
Case True: strErrorMessage = "Dette brugernavn eller IP adresse er banned!"
Case False: strErrorMessage = "Dette rum er fyldt! Vælg et andet rum at chatte i."
End Select
End If
End If
If strMode = "" Or strErrorMessage > "" Then
If Request.Cookies("ezchat")("username") > "" Then
strUsername = LCase(Request.Cookies("ezchat")("username"))
strPassword = LCase(Request.Cookies("ezchat")("password"))
If strRoom = "" Then strRoom = LCase(Request.Cookies("ezchat")("room"))
intSave = 1
Else
intSave = 0
End If
For intIndex = 1 To intSYS_MaxUsers
strAtUser = Application(strUser & intIndex)
If strAtUser > "" And Application(strAtUser & "_dt") > "" Then
intSec = DateDiff("s", Now, Application(strAtUser & "_dt"))
If intSec < 0 Then
Application.Lock
Application(strUser & intIndex) = ""
Application(strAtUser & "_now") = ""
Application(strAtUser & "_regged") = ""
Application(strAtUser & "_admin") = ""
Application(strAtUser & "_away") = ""
Application(strAtUser & "_email") = ""
Application(strAtUser & "_dt") = ""
Application(strAtUser & "_ip") = ""
Application.UnLock
End If
End If
Next
Set Conn = Server.CreateObject("ADODB.Connection")
Set Rs = Server.CreateObject("ADODB.Recordset")
Conn.Open strSystemDSN
strSQL = "SELECT * FROM rooms WHERE lcase(roomname)='" & LCase(strRoom) & "';"
Set Rs = Conn.Execute(strSQL)
bolIsRoom = (Not Rs.BOF And Not Rs.EOF)
Set Rs = Nothing
Conn.Close: Set Conn = Nothing
%>
<%=strSYS_Caption%>
<%=strSYS_Caption%>
Velkommen
til
<%=strSYS_Name%>!
NB:
Du behøver ikke at vælge et password for at
logge på chatten.
Men hvis du vil have alle fordelene, så skal du
logge på med det Brugernavn og password, du
valgte da du registrerede dig på sitet.
OBS OBS OBS !!
Hvis du har pop up killer eller pop up blokering
på
skal
du deaktivere dem i "funktioner" før du kan
benytte denne chat.