Page 1 of 1

Please help me?

Posted: Sat Aug 15, 2009 2:44 pm
by ubunto
Hi
I need some help in creating a Simple PHP Script. I am working on a PHP chat script. there is what i want is 2 users can chat with each and other. There is also a database working on backend. now i found a problem

1. How to create a session between 2 active users? And they can send message to each an other. There session messages should be saved in the backend. And when any user logout there session should be destroyed. and chat stopped.


Please help me....
thanks

Re: Please help me?

Posted: Sat Aug 15, 2009 3:36 pm
by jackpf
Well, what you've basically asked for is the entire script.

What particular part are you having trouble with?

Re: Please help me?

Posted: Sat Aug 15, 2009 3:39 pm
by ubunto
thanks for your reply. I dont need the entire script. here is an example

suppose there are 10 active users on the website. i want them to chat with each and other. and in the same time only 2 users can chat with each an other. my questions are

1. how to create 1 session for 2 users where they can chat? send messages etc etc and those are also stored in db as well. after they end the messages will be deleted and session will be destroyed.



thats what i want......
And if there are 3 active users. Then 2 users will chat and the 3rd one will have to wait..........

Re: Please help me?

Posted: Sat Aug 15, 2009 3:48 pm
by jackpf
Well, you'll have to save the chats in a database.

You can create a new chat when someone clicks a link or something.

Then, set a field to 0 or something. When someone else joins, set it to 1, and only let people join if the field is 0. That way, you can only have 2 people per chat.

Re: Please help me?

Posted: Sat Aug 15, 2009 4:12 pm
by ubunto
Thanks. It helps me but still i have some confusions.

there are 2 users who came in the chat webpage. now what will happened .....


1. Login to chat room...
2. System will check is there any available user to chat if yes then....
3. Pass the user to that page......

how both users will be passed to that specific page?

Re: Please help me?

Posted: Sat Aug 15, 2009 4:18 pm
by jackpf
You'll have to show the user a list of available chats or something.

Re: Please help me?

Posted: Sat Aug 15, 2009 9:02 pm
by Benjamin
:arrow: Moved to PHP - Code

Re: Please help me?

Posted: Sat Aug 15, 2009 9:07 pm
by aceconcepts
Like jackpf said - you'll have to get one user to request to chat with another. Providing each user has some distinguishing ID etc you can then link them together for the duration of their chat.

How much guidence do you need? I'm not being aggressive, just wondering what level you're at?