View Single Post
Old 12-02-2012, 09:50 PM   PM User | #1
Clawed
New Coder

 
Join Date: Nov 2012
Location: United Kingdom
Posts: 29
Thanks: 3
Thanked 0 Times in 0 Posts
Clawed is an unknown quantity at this point
Session timer & idle timer

Hi,

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:
PHP Code:
CREATE TABLE IF NOT EXISTS `user_sessions` (
  `
idint(11NOT NULL AUTO_INCREMENT,
  `
hashvarchar(255NOT NULL,
  `
user_idvarchar(255NOT NULL DEFAULT '0',
  `
last_activityvarchar(255NOT NULL,
  `
ipvarchar(255NOT NULL,
  `
locationvarchar(255NOT NULL,
  `
idleenum('0','1'NOT NULL DEFAULT '0',
  `
loggedinenum('0','1'NOT NULL DEFAULT '0',
  
PRIMARY KEY (`id`)
ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=
hash = md5(session_id())
user_id = userid
last_activity = time(), last time they was active on forum
and so on.

I need to know how to make it so when users are online but idle for more than 5 mins or so it goes to idle, i'm not to sure if it's anything to do with Javascript or jQuery.

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.
Clawed is offline   Reply With Quote