den er skrevet meget forvirrende, når jeg ligger den ud her.
jeg tror vist jeg skulle ha´set i andre afsnit i sin tid
<% Response.Buffer = True %>
<!--#include file="system.asp" -->
<%
strMode = Request("mode")
strMsg = Request("msg")
If strMode = "chat" Then
%><!--#include file="include/frameset.asp" --><%
ElseIf strMode = "signup" Then
strSMode = LCase(Request("smode"))
If strSMode = "" Then
%><!--#include file="include/signup.asp" --><%
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")
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');"
%><!--#include file="include/signup_ct.asp" --><%
Else
%><!--#include file="include/signup_at.asp" --><%
End If
End If
End If
ElseIf strMode = "login" Then
Set Conn = Server.CreateObject("ADODB.Connection")
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") = "Welcome to " & strSYS_Name & "! Lookout for tips here!"
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") = "You have " & intCount & " new message(s)! Click on the 'iMail' button to read them!"
Case False: Response.Cookies("easychat")("tip") = "Welcome to " & strSYS_Name & "! Lookout for tips here!"
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
%><!--#include file="include/login.asp" --><%
Else
strErrorMessage = "Det valgte brugernavn er allerede i brug - skriv et andet"
End If
Else
Select Case Len(strPassword) > 0
Case True: strErrorMessage = "Forkert brugernavn eller adgangskode"
Case False: strErrorMessage = "Dette brugernavn er reseveret - skriv et andet"
End Select
End If
Else
Select Case bolFreeUser
Case True: strErrorMessage = "Du er udelukket fra denne chat"
Case False: strErrorMessage = "Rummet er fyldt - vælg et andet rum"
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")
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
%>
<html>
<head>
<title></title>
<title><%=strSYS_Caption%></title>
<link rel="stylesheet" type="text/css" href="chat.css">
<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<script language="JavaScript1.2">
var bookmarkurl=""
var bookmarktitle=""
function addbookmark(){
if (document.all)
window.external.AddFavorite(bookmarkurl,bookmarktitle)
}
</script>
<link rel="stylesheet" type="text/css" href="style1.css">
<SCRIPT language=JavaScript1.2>
function disableselect(e){
return false
}
function reEnable(){
return true
}
//if IE4+
document.onselectstart=new Function ("return false")
//if NS6
if (window.sidebar){
document.onmousedown=disableselect
document.onclick=reEnable
}
</SCRIPT>
<SCRIPT language=JavaScript>
<!--
var message="Function Disabled!";
///////////////////////////////////
function clickIE() {if (document.all) {alert(message);return false;}}
function clickNS(e) {if
(document.layers||(document.getElementById&&!document.all)) {
if (e.which==2||e.which==3) {alert(message);return false;}}}
if (document.layers)
{document.captureEvents(Event.MOUSEDOWN);document.onmousedown=clickNS;}
else{document.onmouseup=clickNS;document.oncontextmenu=clickIE;}
document.oncontextmenu=new Function("return false")
// -->
</SCRIPT>
<script language="JavaScript1.2">
var bookmarkurl="
http://8000c.net"var bookmarktitle="8000c.net"
function addbookmark(){
if (document.all)
window.external.AddFavorite(bookmarkurl,bookmarktitle)
}
</script>
</head>
<body text="#000000" link="#000099" vlink="#000099" alink="#000099" style="background-color: #FFFFFF; ">
<html>
<div align="center">
<center>
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" width="790" id="AutoNumber7" height="540" bgcolor="#FFFFFF">
<tr>
<td width="100%" align="center" height="540">
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="74%" id="AutoNumber8">
<tr>
<td width="100%">
<p align="center"><br>
<br>
</p>
<div align="center">
<center>
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="100%" id="AutoNumber9">
<tr>
<td width="16%"> </td>
<td width="84%"> </td>
</tr>
</table>
</center>
</div>
<p align="center"><font size="4"></font></td>
</tr>
<tr>
<td width="100%"> </td>
</tr>
</table>
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="74%" id="AutoNumber10">
<tr>
<td width="100%">
</td>
</tr>
</table>
<center><font face="Tahoma, Arial" size="5"><b><%=strSYS_Caption%></b></font></center>
<table border="0" width="500" height="227" style="border-collapse: collapse" bordercolor="#111111" cellpadding="0" cellspacing="0">
<tr>
<td valign="top" height="223"><center>
<table border="0" width="743" cellpadding="0" cellspacing="0">
<tr>
<td valign="top" width="1"></td>
<td valign="top" width="743" align="center">
<form name="frmLogin" method="post" action="default.asp" onsubmit="return checkform(this);" target="_self">
<input type="hidden" name="mode" value="login"><input type="hidden" name="save" value="<%=intSave%>">
<table width="400" border="0" cellspacing="0" cellpadding="0" bordercolorlight="#C0C0C0" style="border-collapse: collapse" bordercolor="#111111">
<tr>
<td valign="top" width="8"></td>
<td valign="top" width="776" align="center">
<table border="0" width="100%" cellspacing="0" cellpadding="0">
<tr>
<td width="100%"></center>
<div align="center">
<center>
<table border="1" width="348" cellspacing="1" cellpadding="4" style="border-collapse: collapse" bordercolor="#111111" bgcolor="#FFFFFF">
<tr>
<td width="30%">
<p align="right">
<font size="2"> </font>Vælg
et rum:</td>
<center>
<td width="50%">
<font color="#FFFFFF" face="Verdana" size="2">
<select name="room" class="Field" style="position:; left: 86px; top: 39px; width: 163px; font-size: 9pt" onchange="location.href='default.asp?room='+this.value;">
<%
Set Conn = Server.CreateObject("ADODB.Connection")
Conn.Open strSystemDSN
strSQL = "SELECT * FROM rooms;"
Set Rs = Conn.Execute(strSQL)
Do Until Rs.Bof Or Rs.Eof
strRoomName = Rs("RoomName")
If LCase(strRoomName) = LCase(strRoom) Then strSel = " selected" Else strSel = ""
Response.Write " <option value='" & LCase(strRoomName) & "'" & strSel & ">" & strRoomName
Rs.MoveNext
Loop
Set Rs = Nothing
Conn.Close: Set Conn = Nothing
%>
</select></font></td>
</tr>
</center>
<tr>
<td width="30%">
<p align="right"> Indtast brugernavn:</td>
<center>
<td width="50%">
<font color="#FFFFFF" face="Verdana" size="2"><input type="text" name="username" maxlength="15" class="Field" style="left: 90px; top: 49px; width: 155; height: 18" value="<%=strUsername%>" size="20"></font><font size="2" color="#FFFFFF">
</font>
<font color="#FFFFFF" face="Verdana" size="2">
<input type="submit" class="txtInfo" value="Log ind" name="B1"></font></td>
</tr>
</table>
</center>
</div>
</center></td>
</tr>
</table>
<center>
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="100%" id="AutoNumber11">
<tr>
<td width="100%" align="center"><font size="2" face="AvantGarde Bk BT">
<br>
</font></td>
</tr>
<tr>
<td width="100%" align="center"><font size="2">
</font></td>
</tr>
</table>
<p> </p>
<table width="100%" border="1" cellspacing="1" style="border-collapse: collapse" bordercolor="#111111" cellpadding="4">
<tr>
<td valign="top" bordercolorlight="#808000">
<blockquote>
<p>
<font size="1" face="Verdana">
Hvem
er på det valgte rum?:<font color="#CC0000"><b> <%=strRoom%></b></font></font><font size="2" face="AvantGarde Bk BT"><font face="Proxy 1" color="#ff0000" size="3"><br>
</p>
</blockquote>
</font>
<font face="Verdana" color="#000000" size="1">
<table width="201" border="0" cellpadding="0" cellspacing="0">
<%
intUserFound = 0
For intIndex = 0 To 30
strChatName = Application(strUser & intIndex)
If Not IsNull(strChatName) And Not strChatName = "" Then
intUserFound = True
Select Case C(Application(strChatName & "_admin"))
Case 0: strImg = "user"
Case -1: strImg = "co-admin"
Case -2: strImg = "admin"
Case -3: strImg = "sysadm"
End Select
If C(Application(strChatName & "_away")) = 1 Then strImg = strImg & "_a"
Response.Write "<tr><td width=10></td><td width=16 bgcolor=#ffffff></td><td width=165 bgcolor=#ffffff><font face='Proxy 1' size=2>" & strChatName & "<font></td><td width=10></td></tr>" & vbCrLf
End If
Next
If Not intUserFound Then Response.Write "<tr><td width=10></td><td width=181 bgcolor=#ffffff><font face='Proxy 1' size=2>Ingen brugere<font></td><td width=10></td></tr>" & vbCrLf
%><font face="Proxy 1" color="#000000">
</table>
</font>
<p>
<br>
<html>
<html>
<title></title>
<head>
</head>
<body link="#000099" vlink="#000099" alink="#000099" style="background-color: #FFFFFF; ">
</body>
</html>
</font></td>
</tr>
</table>
</center></td>
</tr>
</table>
</form>
</td>
</tr>
</table>
</table>
<p align="center"> </p>
</td>
</tr>
</table>
</center>
</div>
</body>
<%
If Len(strErrorMessage) > 0 Then Response.Write "<script language='JavaScript'>alert('" & strErrorMessage &"');</script>"
Response.Write "</html>"
End If
%>