<%
' standard indstillinger
font = "<font face='arial' size='2'>"
page_header = "Nocturnes 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://www.nocturne.subnet.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="chat.asp?mode=chat_frame" name="chat_frame">
<frame src="chat.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 "chat.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=chat.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='chat.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='chat.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
%>
kopier denne kode ind i en tekst editor og gem siden som en asp side, så skulle det gerne virke...