Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Multiple chat rooms

Status
Not open for further replies.

Molenski

IS-IT--Management
Jan 24, 2002
288
DE
Hi there,

I have used ASP for Dummies (the book!) to create a chat room. I found it very helpful as I am in fact a real dummie at this ASP game.

I think it's quite simple, you enter your nickname, click a button which takes you to a frames page showing all users, the messages and allows you to add to the conversation.

Couple of things though - does anyone know how hard it would be to allow users to create multiple rooms? I'd like users to just type a room name in and create a room with possibly the option to password protect it. Also, when you log back in to the chat room you can still see the messages from the previous session. I'd like the messages to be gone each time you login if that makes sense.

As you can probably tell it's gonna need to be explained simply!!!!! I am doing my best to learn but with limited time and about a million other things to do it's quite difficult.

Thanks a lot if you can help.

Molenski
As my bessie bud Kev always says - "Get involved!!!"
 
Ok as i remember that chat example i used for my phpChat with rooms.

MAke a rooms table where you store your rooms.
You need is to have another field named room wich stores the room where user is.

And when displaying the messages for 1 user you select only those that are on same room as user.

I dont knw if i was to helpfull but this is the main ideea.

________
George, M
 
Okay I created a chat room (although I used J2EE, the concepts are the same).

Shaddow's suggestions regarding a table for the rooms is good. When someone wants to create a new room, check that table to make sure it's not already there. Then, create an entry into the "rooms" table. It (your table) might look like this:

RoomName Status Password
-------- ------ --------
General Public
MyRoom1 Private friend
.
.

Then, every time you "refresh" your chat room, only grab messages from the same "RoomName"

Next, you asked about only seeing messages since your session began. For that, you need to include a timestamp for each message, and for the user's logon. You will need an "active users" table, which includes:


UserName LogonTimestamp Room
-------- ------ --------
John 07:32:19.01 General
Mike 09:41:23.65 General
Jane 10:34:56.93 MyRoom1
.
.

Then, when you refresh the chat room: grab all messages with the same "RoomName" and "Timestamp > LogonTimestamp". Get it? Then, you can also generate a "Users in the Chat Room" feature by searching the Users table for all users where "Room = Room." If you have any more trouble, just come back and ask. :)

RJ

************
RudeJohn
************
 
OK, thanks to both of you for getting back to me. I'll have a good look at what you said when I get chance.

If I get stuck which I reckon I will :-( I'll get back to you - you've gotta bear in mind that I really don't have a clue about this and it's difficult learning it myself from books, especially only ever having any experience with HTML! It may be a few days but will you get an email from the forum saying that I've left another message???

Once again thanks to both of you and I hope you don't mind hearing from me soon!

Molenski
As my bessie bud Kev always says - "Get involved!!!"
 
I'll check back.

RJ

************
RudeJohn
************
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top