Log in

View Full Version : How to count differents IPs in sessions?


luroca
03-04-2006, 11:53 AM
Hello, with this:

$maxtime = TIMENOW - $vbulletin->options['cookietimeout'];
$login = $vbulletin->db->query_first("
SELECT count(*) as number, host as host
FROM " . TABLE_PREFIX . "session
WHERE lastactivity >= $maxtime
AND userid = " . $vbulletin->userinfo[userid] . " GROUP BY number");

I get a number of IPs ($login['host']) for one userid but some of them are the same, repeated, I need to get the different IPs, not repeated.

Can anyone help me?

Thanks a lot

Myself

$maxtime = TIMENOW - $vbulletin->options['cookietimeout'];
$login = $vbulletin->db->query_first("
SELECT count(DISTINTC host) as host
FROM " . TABLE_PREFIX . "session
WHERE lastactivity >= $maxtime
AND userid = " . $vbulletin->userinfo[userid] . "");

I love Google.