Tools Links Login

Chat program

Chat program useing arrays.

Original Author: Bhushan-

Code

1. //chatpage.asp


Chat Page






name this file as chatpage.asp. here we are dividing the page into 2 frames.
Next open another page and type the following code..
2. // Display.asp
<%
set MyServer=Request.ServerVariables("SERVER_NAME")
set MyPath=Request.ServerVariables("SCRIPT_NAME")
MySelf="HTTP://"&MyServer&MyPath
%>



Display Page


<%=NOW%>


<%
TempArray=Application("Talk")
FOR i=0 to Application("TPlace")-1
Response.Write("

"&Temparray(i))
NEXT
%>


name the page as display.asp. here the message typed by the user is captured in a Application level variable. Then the message is put in an array and is written on to the browser by reading from that array variable.
Next open another page and type the following code ..
3. // Message.asp

<%
IF not Request.Form("message")="" THEN
Application.LOCK
IF Application("TPlace")>4 THEN
Application("TPlace")=0
END IF
TempArray=Application("Talk")
TempArray(Application("TPlace"))=Request.Form("message")
Application("Talk")=TempArray
Application("TPlace")=Application("TPlace")+1
Application.Unlock
END IF
%>

Message Page








In this page we are creating a text field and a submit button. After typing a message if u click on submit button the message is captured in application variable which will be used by the display.asp

Next open notepad and type the following code and save it as global.asa
4. ///global.asa

About this post

Posted: 2002-06-01
By: ArchiveBot
Viewed: 75 times

Categories

ASP/ HTML

Attachments

No attachments for this post


Loading Comments ...

Comments

No comments have been added for this post.

You must be logged in to make a comment.