I knew a little bit about PHP and I'm quite new with it. What does it required to display all users who logged into site? I really need help!
There are two ways to do this: 1.Create a table, where everytime a user logs in, a record is added 2.Add a column in the user table, which tracks the last time a user logged in.
How do you want to track them? A list of every time every user logged in? A list of all users who log in? You can't really "track" who's currently logged in, because a lot of people don't ever log out, they log in, then leave the site, and there's no way to tell if they leave. (The web is a "disconnected model" - you connect, get the page and disconnect, you don't stay connected while you're reading the page.)
Everytime someone logs in, you update a timestamp column, which keeps track of the last time people logged in. If you want a overview of who's online, you might want to update the column every time an action is taken
Every time a user logs in - insert a new record in the database login table for that user. A list - "select distinct login from logins"
Also, after inserting the timestamp into the database, use a script to update the timestamp for each logged in user (using a cookie). If the cookie is not present, the timestamp would be compared to a time value (usually 3 or 5 minutes) and after this period is over, just delete the user (user name or user id).
You better use the trick bellow than record a user logged in timestamps into database: http://www.shoemoney.com/2011/08/25/how-to-profit-from-invading-your-users-privacy/
I started to work with codes but I'm stucked with a problem. I had done the login page and the main page. But how I'm going to add the time stamp? I mean when user press the login button, what should I do? How does the time stamp works? How am I going to add the time stamp to the specific user?
Have you ever tried to search for an answer before posting a question ? The only two functions you need to get it up and running: http://php.net/manual/en/function.time.php http://php.net/manual/en/function.mysql-query.php