Jump to content

Php + Ajax Chat


razaviv
 Share

Recommended Posts

hello, i need help with php and ajax chat in my site.i started build the chat, and for the first step i should have list of online users.i thought about the algorithm of online user list, and i was thinking about this:make in the database variable that will countdown from a specific number, something like 5, it will countdown, and if it will reaches0 the user will accepted as offlie, but while he is online he is automaticly running ajax function so will update it to 5 again and again untill he will logout. but i dont know how to set in database some variable in such metod. if you do, or have another explanation for such think, please help.and the chat it self. i thought about algorithm that i will insert data into database from two users (that speaking one each other in the chat)and he will automaticly will be selected by the users by ajax function that work with countdown (settimeout)so i tried this, but the chat is easy stop working, and have a little of bugs (i havent finished him yet, actually that was just a try for it)so if you have some good explanation for this problem, some good algorithm, please tell me.thanks, and sorry for my english..

Link to comment
Share on other sites

For determining who is online, most systems use the last access time. There's a thread here with custom session handlers which will store sessions in the database, and it includes a way to figure out who was online within a certain amount of time:http://w3schools.invisionzone.com/index.php?showtopic=9731If your other code is having problems or errors, you'll need to post the code and post any error messages or describe the problem in detail so that people can help.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...