SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    Rehab is for quiters! spartan's Avatar
    Join Date
    Apr 2002
    Location
    Cape Town, South Africa
    Posts
    343
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    asp chat program

    OK, i'm writing a asp chat thingy.
    I started last weak and just really quickly threw something together.

    At the moment it counts the users online and shows a list of names at the top of the page.
    It allows you to select a handle and it stores that handle in a cookie.

    when you submit a message it puts the message and the handle of the poster into a application variable

    --> now for the interesting part, becasue I dont knwoe what the best way is to do this, but this is what I came up with <----


    I have a string I call the splitter
    splitter = "-//|^|\\-" and I put all the messages followed by the handle of the poster into one app var.

    when I want to get them out again I just use split() to put everything into a array and there we go.

    So now I'm wondering about a lot of stuff.

    1. how would you guys handle the messages and handles?... differently than I did (with the splitter)?

    2. how would you let people open their own private chat rooms and how would you let someone send a message to another user so that only that person can see it.

    I'm not currently using a DB and I want to get as far as possible without one, since I'm hosting this on buddies works server I'll get my own space sometime... later... whenever... blah

    anyway. For the moment I would just like to chat about different ways of doing the above. All ides welcome. I'm shure there are numerous ways of doing this!

    cheers
    Spartan
    ---------------------
    It's like our sergeant told us before one trip into the jungle. Men! Fifty of you are leaving on a mission. Twenty-five of you ain't coming back.
    -Mr.Payne

  2. #2
    Froot r gewd SubKamran's Avatar
    Join Date
    May 2002
    Location
    North Star State
    Posts
    597
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I did it the same way, only not with a splitter...

    It looks something like:

    [vbs]

    Function ReplMe(str)
    str = Replace(str,"/me", "")
    ReplMe = str
    End Function

    Function StripHTML(str)
    str = Replace(str,"<","&lt;")
    str = Replace(str,">","&gt;")
    StripHTML = str
    End Function

    If Trim(Request.Form("say")) <> "" Then

    If InStr(Request.Form("say"),"/me") Then
    Application.Lock
    Application("conversation") = "<span style=""color: " & Session("color") & ";font-style: italic"">" & _
    Session("name") & "" & _
    StripHTML(ReplMe(Request.Form("say"))) & "</span><br />" & vbNewLine & _
    Application("conversation")
    Application.Unlock
    Else


    Application.Lock
    Application("conversation") = "<span style=""color: " & Session("color") & """><b>" & _
    Session("name") & ": </b></span>" & _
    StripHTML(Request.Form("say")) & "<br />" & vbNewLine & _
    Application("conversation")
    Application.Unlock

    End If
    End If
    [/vbs]

    Which, uh, is the exact code

    My chat is a frame page...
    "Sometimes little is more."
    Kamran A
    Web Dev/Designer
    Keyboard not found: Please Press F1 to Continue


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •