<%
' -----------------------------------------------------------------------
' Chat System
' Udviklet af : Tony Fonager / Netcoders.dk
' Dato : 8-12-1998
' Kommentar : Denne sourcekode må bruges frit, men ikke commercielt.
' Note : Der er brugt TAB på 4, ved opsætningen af source.
' Krav : ASP baseret NT server!
' -----------------------------------------------------------------------
' standard indstillinger
font = "<font face='arial' size='2'>"
page_header = "Netcoders Chat System"
page_bgcolor = "#aa8833"
page_logoncolor = "#ffaa44"
dato_color = "#ffffff"
name_color = "#ffff00"
text_color = "#ffffff"
' cache hele outputtet
response.buffer = true
' logoff URL - der hvor brugeren redirectes hen, ved at indtaste "/logoff"
logoff_url = "
http://netcoders.dk" ' antal synlige linier i chat vinduet
antal_linier = 20
' hent dokument mode
mode = request("mode")
' ----------------------------------------------------
' setup frameset
' ----------------------------------------------------
if mode = "" then
%>
<html>
<head><title><% = page_header %></title></head>
<frameset rows="*,50">
<frame src="default.asp?mode=chat_frame" name="chat_frame">
<frame src="default.asp?mode=name_frame" name="name_frame">
</frameset>
</html>
<%
end if
' ----------------------------------------------------
' gem ny brugers navn
' ----------------------------------------------------
if mode = "savename" then
session("chatname") = request("chatname")
for x = antal_linier to 2 step -1
application("chatline_" & x) = application("chatline_" & x-1)
next
application("chatline_1") = "<b><font color='" & page_logoncolor & "'>" & session("chatname") & " er logget på kl. " & now & "</b></font>"
mode = "name_frame"
end if
' ----------------------------------------------------
' send en besked til chatten
' ----------------------------------------------------
if mode = "send" then
for x = antal_linier to 2 step -1
application("chatline_" & x) = application("chatline_" & x-1)
next
besked = request("besked")
' /logoff - logger en person af chatten
if besked = "/logoff" then
for x = antal_linier to 2 step -1
application("chatline_" & x) = application("chatline_" & x-1)
next
application("chatline_1") = "<b><font color='#ffff00'>" & session("chatname") & " er logget af kl. " & now & "</b></font>"
session("chatname") = ""
%>
<script language="javascript">
top.location.href="<% = logoff_url %>";
</script>
<%
response.end
else
application("chatline_1") = "<font color='" & dato_color & "'><b>" & now & "</font> <font color='" & name_color & "'>" & session("chatname") & "</font> : <font color='" & text_color & "'>" & besked & "</b></font>"
response.redirect "default.asp?mode=chat_frame"
end if
end if
' ----------------------------------------------------
' udskriver alle chat linier på chat vinduet
' ----------------------------------------------------
if mode = "chat_frame" then
response.write "<html><head><META HTTP-EQUIV='Refresh' CONTENT='10;URL=default.asp?mode=chat_frame'></head>"
for x = 1 to antal_linier
response.write "<body bgcolor='" & page_bgcolor & "' text=black link=black alink=black vlink=black topmargin='10' leftmargin='10'>" & font
response.write application("chatline_" & x) & "<br>"
next
end if
' ----------------------------------------------------
' beder om ny brugers navn, eller tager imod chatbesked
' ----------------------------------------------------
if mode = "name_frame" then
response.write "<html><body>" & font
if session("chatname") = "" then
response.write "<form name='getname' action='default.asp'><input type='hidden' name='mode' value='savename'>Indtast dit navn : <input type='text' name='chatname' size='40'> <input type='submit' value='Login'></form>"
else
response.write "<form name='getname' target='chat_frame' action='default.asp'><input type='hidden' name='mode' value='send'>Besked : <input type='text' name='besked' size='35'> <input type='submit' value='Send'>"
response.write "</form>"
end if
response.write "</font></body></html>"
end if
%>