i want to find a simple way of incorporating into my website the number of people which are currently viewing. I just want to be able to display a simple message saying "there are people online". How can this be obtained using PHP, or does a database need to be used too?
I want to show authenticated online users on my website. My current scenario is:
1. When user logs in, his status is updated into the database as active
2. When logs out, his status is updated as inactive in db.
The problem is if a user does't logout, instead closes browser, his status is not recorded... so he is always active... How can I overcome this problem. How can I know that a specific user. e.g. username james is online or offline... is there a way that his status is automatically updated to database if inactive for some time.
I'm trying to create a system where I can monitor where users are at on my website. There's no log-in system or account system where a user can register so this will be based completely off ip address. I'm wanting to have a function where I can set where a user is at so it's easier for me to specify where they are.. like this: SetLocation("Account Settings");
I'm sure that function will be easy to make, but I can't figure out how to make the database though. Of course I know how to make the database, but I don't know the most optimal way to make the database with the correct tables and fields. I wanted to store all of the users (that ever access my website along with original time/date on view, last time viewing, current location) and I also wanted to see who is online within the last 15 minutes.. so I'm guessing I'll need an "online" table, but not sure what kind of information that would hold.
Most websites require that the username be unique. I'm noticing that SO allows duplicate usernames, which could be good when you have a very large website like SO (which I'm guessing they do to avoid usernames like chris123, chris213, chris321 which start to look confusing themselves). But is allowing duplicate usernames generally a relatively poor implementation? It can be confusing to get 2 answers from 2 users that have the same username. So what other alternatives are there for large sites that have a large number of users that need to interact with each other? I'm thinking something that's not even username-based, but not sure what.
I have a column in my datasase and whenever you login, it sets it to "yes". The Users online just retrieves all users that have "yes" in that column. However, the only way to get the user off the Users Online list (make the column "no") is to go via logout. I don't want this to be the users only choice. I want the online column in the database to be set to "no" if they have been on a page for 30 minutes. Now I figured out most of the code, but I can't seem to find a way to track the number of minutes (or any time) that the user has been on the page. I tried incorporation JS but I can't get that to work. I tried cookie's but I got nothing. BTW: I'm using sessions so $_SESSION['online'] controls the online status.
Can someone please help me track the minutes the user has been on the page?
I cant recall but like most forums, on the bottom of each users post they have an icon if that person supplied thier AIM or YAHOO or whatever name. Now I recall in the past I saw on one forum that the icon changes to green indicating that the user is online.
But I cant tell if it was for one of the chat icons or if it was for indicating if the user was on the forum at the moment. If it was for the forum that ok, I can understand how they do that, but if you can indicate if that user is online on that specific chat program that they supplied thier screen name too, then I would like to know how to do this.
I'm in the middle of programming my own forums. i recently ran into trouble with how to show the most amount of users ever online. i know it can be done as phpbb has it. and no i dont want to switch to phpbb considering im over 80% done on my forum.
i have a signin site and in the page accessible only to members there is a section updating all the time with a refresh with a list of users currently online. Fine all this works and I have done the signout part no problem which deletes the users entry in the sessions table and kills the cookie on his machine at the same time.
now if the person does not logout i have the cookie set to expire in an hour, so for that user when they come back they will have to log on, however the entry in the sessions table will stay there so to other users on the site it will look like the person is always logged on, get me? so is there a way to kill the entry in the sessions table after a certain amount of time or will using sessions in php4 help solve this problem in any way.
I am developing a web-based game with a full user/account based system. One of the features I plan to add is a buddy list, where users can select other users as 'friends' or whatnot and then have them on a quickly accessibly buddy list for messaging, viewing game status, and inviting to games etc. Code:
Right now I'm programming a user authentication system in PHP and I have a question about a fun feature I want to add. I want to have one of those things that tells you if a user is logged on at the moment, such as the one on PHP Freaks. I was thinking that I should have a mySQL table dedicated solely to online users. I just don't know how (and where) I should put the script that deletes old users from the "online" table, say if the users didn't use the log out feature, but just closed his/her browser.