php - how to handle online status. guest, users etc -


How many users and guests are the best way to keep track of online? Fun and creating forum to learn

Now I have 2 fields in the user table named is_online and last_access_time I

if current time 5 minutes or more that is more than last_access_time, it is at zero I and if I set the signed user refresh browser to 1,

But what about guests? I keep an eye on how many guests are also

One more thing that is really good is to show what the user is watching. And on the page, for example Forum Thread, 5 guests, Homer and Shomar are looking at this page. But how should I structured it? Hmm, maybe I should have another question for this.

I do not know what I should do

What do you suggest?

I'm using cookies for this. Set a cookie when user logging in (first make sure no one exists) to make sure. The easiest way to generate a unique ID for that user is to haveh through the current time from your IP.

$ id = md5 ($ _ server) ['REMOTE_ADDR']. time ());

Store that ID in your database and use it for reference

You can view $ _SERVER ['PHP_SELF'] or grab $ _SERVER ['REQUEST_URI'] Store in that table near the top of your PHP source I take a look at the explanation of the php.net explanation of whats stored in _SERVER Global, because you should get a little more help if you think that you If more is required, then the document on which they are (Pre-index.php)

You may need to separate the query string that was used to access that page, to parse the variables requesting the page. Out. Either way, all this can be done through cookies, or a single cookie can be used to store your unique ID and use your table to store everything else.


Comments

Popular posts from this blog

c# - sqlDecimal to decimal clr stored procedure Unable to cast object of type 'System.Data.SqlTypes.SqlDecimal' to type 'System.IConvertible' -

Calling GetGUIThreadInfo from Outlook VBA -

Obfuscating Python code? -