admin
06-10-2003, 04:20 PM
Part 3
In this part we will now logout the user and delete the value in the chat name cookie. We will also display a message notifying other users that this user has exited the chat room. This is all done in the logoff.asp file. Firstly, to get here the user would have to click on the 'Exit Chat room' button first. Then we have to log out the user. We do this by clearing the 'chatname' cookie. But before we do this we must create a new place for the user's chat name to be stored so that a message can be displayed for notifying other users about the departure of that user. This is done like this:
<%
Dim exitname
exitname = Request.Cookies("Chatname")
exitname_entry = exitname & "#"
Response.Cookies("Chatname")=""
APPLICATION.LOCK
Application("txt13") = Application("txt12")
Application("txt12") = Application("txt11")
Application("txt11") = Application("txt10")
Application("txt10") = Application("txt9")
Application("txt9") = Application("txt8")
Application("txt8") = Application("txt7")
Application("txt7") = Application("txt6")
Application("txt6") = Application("txt5")
Application("txt5") = Application("txt4")
Application("txt4") = Application("txt3")
Application("txt3") = Application("txt2")
Application("txt2") = Application("txt1")
Application("txt1") = "<FONT COLOR=""red"">" & exitname & " Has left the Chat Room.</FONT>"
APPLICATION.UNLOCK
%>
As you can see above another variable is declared 'exitname'. This is done so that the message of the user's departure can be made with the user's chat name. This is because the cookie 'chatname' will be cleared so we will have to save the chat name somewhere else. Here I have saved it in a new cookie called 'exitname'. Now we can use this and display the user's departure message with the user's name. Once this is all done, a confirmation window is shown and then I have made it to redirect to the main page again as shown below:
<HTML>
<HEAD><TITLE>Thank you for Using Kumar's Chat</TITLE>
<meta http-equiv="refresh" content="5; url=default1.asp">
</HEAD>
<BODY>
<CENTER>
You have just exited, Kumar's Chat. In five seconds you will be redirected to the main page
</CENTER>
</BODY>
</HTML>
This is end of part 3 of this article. Now I will show you how to add more lines of text for the display window so that more messages can be displayed at once. This is one of the modifications of this application. Here's how it is done.
Firstly, you open up the default1.asp file then go to the 'APPLICATION.LOCK' section of the page. Then all you have to do is add more 'Application()' functions above the thirteenth line. Like this:
[coce]Application("txt17") = Application("txt16")
Application("txt16") = Application("txt15")
Application("txt15") = Application("txt14")
Application("txt14") = Application("txt13")[/code]
I have only gone up to 17 but you can add more if you like. Now the next step would be to this same thing for the message.asp and logoff.asp file. Then the final step would be to add more application functions again to the display.asp file like this:
<%=Application("txt17")%>
<%=Application("txt16")%>
<%=Application("txt15")%>
<%=Application("txt14")%>
Again, you can add more if you like. That's it for this article.
If you want to download this code then it is available www.braveweb.com/products/Chat_and_Messaging/8D112504-F3D6-11D4-831E-00A0CCD15403/Download.asp
Note: If you wish to use this application in your site, then I would be much obliged if you could just pop be an email kumar @ colacumby.com notifying me of which web site and your name. Thanks.
In this part we will now logout the user and delete the value in the chat name cookie. We will also display a message notifying other users that this user has exited the chat room. This is all done in the logoff.asp file. Firstly, to get here the user would have to click on the 'Exit Chat room' button first. Then we have to log out the user. We do this by clearing the 'chatname' cookie. But before we do this we must create a new place for the user's chat name to be stored so that a message can be displayed for notifying other users about the departure of that user. This is done like this:
<%
Dim exitname
exitname = Request.Cookies("Chatname")
exitname_entry = exitname & "#"
Response.Cookies("Chatname")=""
APPLICATION.LOCK
Application("txt13") = Application("txt12")
Application("txt12") = Application("txt11")
Application("txt11") = Application("txt10")
Application("txt10") = Application("txt9")
Application("txt9") = Application("txt8")
Application("txt8") = Application("txt7")
Application("txt7") = Application("txt6")
Application("txt6") = Application("txt5")
Application("txt5") = Application("txt4")
Application("txt4") = Application("txt3")
Application("txt3") = Application("txt2")
Application("txt2") = Application("txt1")
Application("txt1") = "<FONT COLOR=""red"">" & exitname & " Has left the Chat Room.</FONT>"
APPLICATION.UNLOCK
%>
As you can see above another variable is declared 'exitname'. This is done so that the message of the user's departure can be made with the user's chat name. This is because the cookie 'chatname' will be cleared so we will have to save the chat name somewhere else. Here I have saved it in a new cookie called 'exitname'. Now we can use this and display the user's departure message with the user's name. Once this is all done, a confirmation window is shown and then I have made it to redirect to the main page again as shown below:
<HTML>
<HEAD><TITLE>Thank you for Using Kumar's Chat</TITLE>
<meta http-equiv="refresh" content="5; url=default1.asp">
</HEAD>
<BODY>
<CENTER>
You have just exited, Kumar's Chat. In five seconds you will be redirected to the main page
</CENTER>
</BODY>
</HTML>
This is end of part 3 of this article. Now I will show you how to add more lines of text for the display window so that more messages can be displayed at once. This is one of the modifications of this application. Here's how it is done.
Firstly, you open up the default1.asp file then go to the 'APPLICATION.LOCK' section of the page. Then all you have to do is add more 'Application()' functions above the thirteenth line. Like this:
[coce]Application("txt17") = Application("txt16")
Application("txt16") = Application("txt15")
Application("txt15") = Application("txt14")
Application("txt14") = Application("txt13")[/code]
I have only gone up to 17 but you can add more if you like. Now the next step would be to this same thing for the message.asp and logoff.asp file. Then the final step would be to add more application functions again to the display.asp file like this:
<%=Application("txt17")%>
<%=Application("txt16")%>
<%=Application("txt15")%>
<%=Application("txt14")%>
Again, you can add more if you like. That's it for this article.
If you want to download this code then it is available www.braveweb.com/products/Chat_and_Messaging/8D112504-F3D6-11D4-831E-00A0CCD15403/Download.asp
Note: If you wish to use this application in your site, then I would be much obliged if you could just pop be an email kumar @ colacumby.com notifying me of which web site and your name. Thanks.