PDA

Click to See Complete Forum and Search --> : Creating a web chat program


rino_2
May 26th, 2000, 01:15 AM
Hi,

I have asked this question before and did get an answer but it wasn't quite what I was looking for. I would like to create a chat program completely using VBS. I wouldn't like to create a chat program using ready made code that I just add to my page. If there is somebody who knows how I could do this please help me. Thanks you!

May 28th, 2000, 12:35 AM
Yeah, there's a chat demo that comes with Flash 4...there's a flash movie that sends commands to and from an asp script.
I haven't looked much at the code behind it but it can't be that hard...here's the contents of the asp file:

<%

' Encode a number from 0..15 to a single hex digit
Function HexChar(ByVal i)
If i < 10 Then
HexChar = Chr(i+Asc("0"))
Else
HexChar = Chr(i-10+Asc("A"))
End If
End Function

' Encode the control and punctuation characters in a string to %xx hex values
Function URLEncode(ByVal s)
Dim result, ch
Do While Len(s) > 0
ch = Asc(s)
s = Right(s, Len(s)-1)
If (ch >= Asc("a") And ch <= Asc("z")) Or (ch >= Asc("A") And ch <= Asc("Z")) Then
result = result & Chr(ch)
ElseIf ch = Asc(" ") Then
result = result & "+"
Else
'result = result & "*" & ch
'result = result & "!" & (ch/16) & (ch mod 16)
result = result & "%" & HexChar(Int(ch/16)) & HexChar(ch Mod 16)
End If
Loop
URLEncode = result
End Function

' Never cache the chat session
Response.Expires = 0

' Get the action to perform
action = Request.QueryString("action")

' Get the passed data
msg = Request.form("msg")
user = Request.form("user")
id = Request.form("id")
If Len(id) = 0 Then
id = "default"
End If

' Protect access to the chat session
Application.Lock
If action = "send" Then
' Add the string to the chat session
list = Application(id)
list = list + user + ": " + msg + chr(13)
Application(id) = list
ElseIf action = "clear" Then
' Clear the chat session
list = ""
Application(id) = list
Else 'If action = "update" Then
' Just return the current chat session
list = Application(id)
End If
Application.Unlock

' Return the chat session
response.write("list="+URLEncode(list))

%>

Don't tell Macromedia I did that. :)

[Edited by matthewralston on 05-29-2000 at 07:12 AM]

rino_2
May 28th, 2000, 12:48 AM
Thanks for the help!

May 28th, 2000, 06:07 PM
Kewl!

How many posts do you need to be a "Hyperactive Member"?
I gotta go find out. :)

May 28th, 2000, 06:11 PM
42 More posts to do before I get to be hyperactive!!
That number sounds familiar somehow...must be the answer to something? :)

Mark Sreeves
May 29th, 2000, 08:13 PM
Yeah 42 is the answer to "life, universe and everything" but do you know WHY?











I do! :)