last activity. the ultimate goal is to have an active user list. and a script to be run on every page that updates the users activity.
and then have the inactive users logged out and removed from the active users table in mysql automatically.

my problem is that i dont know where to start i have a good sign in script that works but i dont know what php to put in to make the users get put into the database so they can be updated when they are active on the members pages.

helps? anyone h ave ideas or know what im refering to?

Recommended Answers

All 7 Replies

try to add a date time column in your database
then on login update users set datetime=now

i dont understand how to get the datetime to to now

NOW() is a MySQL function

oh how do u use a mysql function in php?

you could try using the PHP function time(). it will store the time in the database as an integer (Unix timestamp) and that way you can choose to display it on the screen how you want. e.g


$othervars = "othervars";
$current_time = time();

sql = "INSERT INTO yourtable VALUES ('$current_time', ..., '$othervars')";

// If you do not specify what columns the values go into it will insert them in the order they are in the database.

See this for a few of the many ways you can display time how you want.

oh ok but then what do i do after that how do i get the active members? do i have to subtract from time last visited from the current time or something to get the "active" members?

after how long are you wanting them to to be removed?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.