Please help me?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
ubunto
Forum Newbie
Posts: 6
Joined: Tue May 12, 2009 4:58 am

Please help me?

Post 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
User avatar
jackpf
DevNet Resident
Posts: 2119
Joined: Sun Feb 15, 2009 7:22 pm
Location: Ipswich, UK

Re: Please help me?

Post by jackpf »

Well, what you've basically asked for is the entire script.

What particular part are you having trouble with?
ubunto
Forum Newbie
Posts: 6
Joined: Tue May 12, 2009 4:58 am

Re: Please help me?

Post 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..........
User avatar
jackpf
DevNet Resident
Posts: 2119
Joined: Sun Feb 15, 2009 7:22 pm
Location: Ipswich, UK

Re: Please help me?

Post 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.
ubunto
Forum Newbie
Posts: 6
Joined: Tue May 12, 2009 4:58 am

Re: Please help me?

Post 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?
User avatar
jackpf
DevNet Resident
Posts: 2119
Joined: Sun Feb 15, 2009 7:22 pm
Location: Ipswich, UK

Re: Please help me?

Post by jackpf »

You'll have to show the user a list of available chats or something.
User avatar
Benjamin
Site Administrator
Posts: 6935
Joined: Sun May 19, 2002 10:24 pm

Re: Please help me?

Post by Benjamin »

:arrow: Moved to PHP - Code
User avatar
aceconcepts
DevNet Resident
Posts: 1424
Joined: Mon Feb 06, 2006 11:26 am
Location: London

Re: Please help me?

Post 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?
Post Reply