<html>
<head>
<title>ASP Chat Box</title>
<META http-equiv="refresh" content="">
</head>
<body>
<%
if request.Form("func") = "Send" then
nickName = trim(request.Form("nickName"))
chatBox = trim(request.Form("chatBox"))
session("nickName") = nickName
Set objFlSys = Server.CreateObject("Scripting.FileSystemObject")
chatFile = Server.MapPath ("chatlog.txt")
Set objStreamOutput= objFlSys.OpenTextFile (chatFile, 1, TRUE)
ipaddr=Request.ServerVariables("REMOTE_ADDR") & " : "
objStreamOutput.Write "<b>" & nickName & "</b>:"
objStreamOutput.WriteLine chatBox & "<BR>" & vbnewline
Set objStreamOutput = Nothing
end if
Set objFlSys = Server.CreateObject("Scripting.FileSystemObject")
chatFile = Server.MapPath ("chatlog.txt")
Set objStreamInput = objFlSys.OpenTextFile (chatFile, 1, False, False)
Response.Write objStreamInput.ReadALL & "<br/>"
Set objStreamInput=Nothing
var msg = document.getelementbytagName("chatbox").value;
document.getelementbytagName("chatbox0").value = msg;
document.getelementbytagName("chatbox").value = "";
document.formname.action = "filename.asp"
document.formname.submit
%>
<form action="" method="post" >
<strong>Nickname :</strong>
<p>
<input name="nickName" value=""nickName")" size="18"/><br/>
</p>
<p><strong>Message : </strong>
<br/><textarea cols="14" rows="11" name="chatBox"></textarea>
<input type="submit" name="func" value="Send" onclick="Display()"/>
<textarea cols="25" rows="11" name="chatBox0"></textarea></p>
</form>
</body>
</html>
Bookmarks