Current location: Hot Scripts Forums » Programming Languages » ASP » chat script problem


chat script problem

Reply
  #1 (permalink)  
Old 05-12-04, 06:34 AM
piratinc piratinc is offline
Newbie Coder
 
Join Date: Oct 2003
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
Question chat script problem

Hello everyone !


I am a total beginer in ASP and I have an ASP chat script in a single file downloaded from the net...
As a simple chat with a single room works perfectly for my needs but I would like to make this chat multiroom.
To login the chat I use the direct link http://localhost/chat.asp?event=login&username=chatter

What I wanna do exactly... First of all to create the multiroom support wich I am not sure how is posible but I know it ca be done because I have seen similar chat scripts but none were for my needs... way too complicated scripts... I need it as simple as posible! And this being in a single .asp file is perfect for me.
If the multiroom support can be added I would like to use the same direct link to the chat but with room name specified. example: http://localhost/chat.asp?event=login&username=chatter&room=myroom

If anyone can help me with this code to add multiroom support I would really be gracefull !!!

Thank You in advance !!


Bellow is the code I have in the chat.asp :




<%
title="CHAT"

if request("event")="login" then

if (InStr(application("emchatusers"), ","& request("login") &",")<>0) then response.redirect("default.asp?error=1&username=" & request("login"))
Response.Cookies("emchatlogin")=request("login")
application("emchatusers") = application("emchatusers") & request("login") &"," & minute(now) & ","

Application(20)=Application(19)
Application(19)=Application(18)
Application(18)=Application(17)
Application(17)=Application(16)
Application(16)=Application(15)
Application(15)=Application(14)
Application(14)=Application(13)
Application(13)=Application(12)
Application(12)=Application(11)
Application(11)=Application(10)
Application(10)=Application(9)
Application(9)=Application(8)
Application(8)=Application(7)
Application(7)=Application(6)
Application(6)=Application(5)
Application(5)=Application(4)
Application(4)=Application(3)
Application(3)=Application(2)
Application(2)=Application(1)

Application("1")="<font color='green'><b>"& request.Cookies("emchatlogin") & "</b> enters chatroom</font>"
Response.Redirect "chat.asp"
end if

if request.Cookies("emchatlogin")="" then Response.Redirect"default.asp"
if mid(request.Cookies("emchatlogin"),1,1)=" " then Response.Redirect"default.asp"

if request("event")="post" then

Application(20)=Application(19)
Application(19)=Application(18)
Application(18)=Application(17)
Application(17)=Application(16)
Application(16)=Application(15)
Application(15)=Application(14)
Application(14)=Application(13)
Application(13)=Application(12)
Application(12)=Application(11)
Application(11)=Application(10)
Application(10)=Application(9)
Application(9)=Application(8)
Application(8)=Application(7)
Application(7)=Application(6)
Application(6)=Application(5)
Application(5)=Application(4)
Application(4)=Application(3)
Application(3)=Application(2)
Application(2)=Application(1)

Application("1")="<b>" & request.Cookies("emchatlogin") & ":</b>"& request("text")
Response.Redirect "chat.asp?event=form"
end if

if request("event")="logout" then
Application(20)=Application(19)
Application(19)=Application(18)
Application(18)=Application(17)
Application(17)=Application(16)
Application(16)=Application(15)
Application(15)=Application(14)
Application(14)=Application(13)
Application(13)=Application(12)
Application(12)=Application(11)
Application(11)=Application(10)
Application(10)=Application(9)
Application(9)=Application(8)
Application(8)=Application(7)
Application(7)=Application(6)
Application(6)=Application(5)
Application(5)=Application(4)
Application(4)=Application(3)
Application(3)=Application(2)
Application(2)=Application(1)

Application("1")="<font color='green'><b>"& request.Cookies("emchatlogin") & "</b> leaves chatroom</font>"


userarray=split(application("emchatusers"),",")
userscount=int(((UBound(userarray)+1))-0.5)
for f = 0 to userscount-1 step 2
if userarray(f)=request.Cookies("emchatlogin") then
reptmp=userarray(f) & "," & userarray(f+1) &","
application("emchatusers") = replace(application("emchatusers"),reptmp,"")
end if
next



Response.Cookies("emchatlogin")=""
Response.Redirect"default.asp"

end if

if request("event")="form" then
%>

<body bgcolor="#FFCC99" topmargin="5">
<table border="0" width="100%" cellspacing="0" cellpadding="0">
<tr>
<td>
<form action="chat.asp?event=post" method="post" name="chatform">
<input type="text" name="text" size="50"></form>
</td>
<td width="220">
<a href="chat.asp?event=logout" target="_top">EXIT CHAT</a>
</td>
</tr>
</table>


<script language="VBScript">
Sub Window_onLoad
chatform.text.focus
End Sub
</script>
<%
end if


if request("event")="show" then
Response.Write "<meta http-equiv='refresh' content='5'>"
Response.Write "<body bgcolor='#ECE4B0'>"
Response.Write "<font face='arial,verdana' size='2'>"
for f=1 to 20
Response.Write Application(f) & "<br>"
next

userarray=split(application("emchatusers"),",")
userscount=int(((UBound(userarray)+1))-0.5)

for f = 0 to userscount-1 step 2
if abs(minute(now)-int(userarray(f+1))) > 2 then
application("emchatusers")=replace(application("em chatusers"),userarray(f) & "," & userarray(f+1) & ",","")
end if
if userarray(f)=request("userrefresh") then
reptmp=userarray(f) & "," & userarray(f+1) &","
application("emchatusers") = replace(application("emchatusers"),reptmp,userarra y(f) & "," & minute(now) &",")
end if
next
end if

if request("event")="listusers" then
Response.Write "<meta http-equiv='refresh' content='30'>"
Response.Write "<body bgcolor='#FFCC99'>"
Response.Write "<font face='arial,verdana' size='2'>"
userarray=split(application("emchatusers"),",")
userscount=int(((UBound(userarray)+1))-0.5)
for f = 0 to userscount-1 step 2
response.write userarray(f) & "<br>"
next
end if
%>


<title><%=title%></title>
<frameset rows="37,*" frameborder="0">
<frame name="header" scrolling="no" noresize target="main" src="chat.asp?event=form">
<frameset cols="*,120">
<frame name="main" target="main" scrolling="auto" noresize src="chat.asp?event=show&userrefresh=<%=request.Co okies("emchatlogin")%>">
<frame name="main" scrolling="auto" noresize src="chat.asp?event=listusers" target="main">
</frameset>
<noframes>
<body>

<p>This page uses frames, but your browser doesn't support them.</p>

</body>
</noframes>
</frameset>
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #2 (permalink)  
Old 05-21-04, 09:40 AM
piratinc piratinc is offline
Newbie Coder
 
Join Date: Oct 2003
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
seems no solutions so far...

Is this a really hard one ?!
Just wondering... i am still trying to figure this out but can't
Please... help!!!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #3 (permalink)  
Old 05-27-04, 08:52 AM
piratinc piratinc is offline
Newbie Coder
 
Join Date: Oct 2003
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
i am giving up

As far as no one could help me with this one... I declare the subject dead. Thanks for your help...
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Is there any integrity of script rankings? webmaster@atmanager.com Hot Scripts Forum Questions, Suggestions and Feedback 17 08-06-04 01:12 AM
Webcam chat script anyone? MikeNL Script Requests 1 05-13-04 12:07 AM
REQ: chat script mrjones Script Requests 0 01-30-04 10:59 AM
live chat script, form script, autoresponder, babalu Script Requests 0 12-04-03 02:55 PM
The best PHP chat script... lord PHP 1 08-03-03 06:04 AM


All times are GMT -5. The time now is 10:01 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.