Welcome Guest, Not a member yet? Register   Sign In
Sesssion last_activity column checking if a user is online
#1

[eluser]GabrieleMartino[/eluser]
Hello,

I have tried a solution to to have the user online but it doesn't work. Some one knows ?

This is the solution that's do not work,

Code:
$this->db->where('last_activity >=', 'DATE_SUB(CURRENT_TIMESTAMP, INTERVAL 2 MINUTE)');

It gives me users also after 2 minutes.

The other solution I tried is

Code:
$now = time()-120;
     $time = mktime(gmdate("H", $now), gmdate("i", $now), gmdate("s", $now), gmdate("m", $now), gmdate("d", $now), gmdate("Y", $now));
            $this->db->where('last_activity >=', $time);

By the way blue and white is not clear as the forum before (my opinion).
#2

[eluser]GabrieleMartino[/eluser]
[quote author="GabrieleMartino" date="1356608831"]Hello,

I have tried a solution to to have the user online but it doesn't work. Some one knows ?

This is the solution that's do not work,

Code:
$this->db->where('last_activity >=', 'DATE_SUB(CURRENT_TIMESTAMP, INTERVAL 2 MINUTE)');

It gives me users also after 2 minutes.

The other solution I tried is

Code:
$now = time()-120;
     $time = mktime(gmdate("H", $now), gmdate("i", $now), gmdate("s", $now), gmdate("m", $now), gmdate("d", $now), gmdate("Y", $now));
            $this->db->where('last_activity >=', $time);

By the way blue and white is not clear as the forum before (my opinion).[/quote]

The 2 method works!




Theme © iAndrew 2016 - Forum software by © MyBB