Over the past few months i've been learning PHP & i've learnt quite a far bit but recently someone asked me to test my skills and code my own social network site for a small community.
I've got the design & everything sorted i just want to now how to make user's idle in user_sessions.
Here's my table:
CREATE TABLE IF NOT EXISTS `user_sessions` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`hash` varchar(255) NOT NULL,
`user_id` varchar(255) NOT NULL DEFAULT '0',
`last_activity` varchar(255) NOT NULL,
`ip` varchar(255) NOT NULL,
`location` varchar(255) NOT NULL,
`idle` enum('0','1') NOT NULL DEFAULT '0',
`loggedin` enum('0','1') NOT NULL DEFAULT '0',
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
hash = md5(session_id())
user_id = userid
last_activity = time(), last time they was active on forum
and so on.
Because the way i look at it once the user has been inactive for more than 5 mins once they click a link or something my CMS will log them out and i don't want that, i want it to set it to idle, until they either leave the domain or they logout.
If anyone can help will be much appreciated thanks.