How to make a window in the chat Who is in this location?

Closed due to the fact that the essence of the question is not clear to the participants Visman , ThisMan , RussCoder , tutankhamun , Yura Ivanov Oct 11 '15 at 10:41 .

Try to write more detailed questions. To get an answer, explain what exactly you see the problem, how to reproduce it, what you want to get as a result, etc. Give an example that clearly demonstrates the problem. If the question can be reformulated according to the rules set out in the certificate , edit it .

  • one
    "Who is on this location" on which location? What is meant ? - Alex Kapustin 2:41 pm
  • Who is online =) - k0mar

1 answer 1

All locations have a certain ID. - the number by which the system distinguishes locations. This ID must be written to the database in the user’s string. Further,

mysql_query('select * from `users` where `location_id`='.$location_id); 

If the user is logged out (the last action was performed a very long time ago, more than the session time), do not show it in the chat.

 mysql_query('select * from `users` where `location_id`='.$location_id.' and `last_action_time`<'.time()-ini_get("session.gc_maxlifetime").'); 

PS To the people who minus the question: have a conscience, this is one of the most interesting questions, and most importantly, normally, hard-to-implement.
The thing is that it is almost impossible to force the user to click on the "exit" button (only under the threat of withdrawing game finances or selecting items), and it is also extremely difficult to distinguish when the user forgot to press the output, and when he simply has problems with the Internet.
So, a full test up to a minute can take more than a dozen lines and require modules both on the server side and on the client side. SO THAT.

PPS But the fact that he was asked by a person, normally, asking very simple questions does not mean anything. Read about the invention of car wipers. =)

  • Thank you =) you are right as always =)))) - k0mar
  • 2
    uh You have a good fantasy. I did not understand the question from the presentation :) - Alex Kapustin
  • oh, not always =) But I try to solve the problem, not the person. The reasons I have already [described] [1] [1]: hashcode.ru/questions/29447/kak- do -yunita - php - mysql - knes
  • @shurik, I’ve been working for a long time as a tech-admin on the Harry Potter forum, and also raised temporary boards for browser games and other things. After that, no customer pearls are not scary. And here - everything is clear, especially if you look selectively at least at the headings of the previous questions. - knes
  • @knes, I don’t even know which title and description is right for this question ... - angry