<?php
/*
* @package LabCMS
* @copyright (c) 2006 Alexander Levin aka Loki (loki_angel@mail.ru)
* @support http://labcms.ru
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*/
	$mod_template="clones.tpl";
	
	$clones_count=(intval($_GET['var1']?$_GET['var1']:1));
	$period=intval($_GET['var2']);
	
	$result=Db::i()->select("SELECT user_id, login, INET_NTOA(u.last_ip) ip, register_date, last_visit, pass FROM (SELECT last_ip, COUNT(last_ip) as counter FROM ?_users WHERE {last_visit>NOW() - INTERVAL ?d DAY AND }`status`!=-1 GROUP BY last_ip) as  i JOIN ?_users u ON i.last_ip=u.last_ip WHERE counter>?d  AND `status`!=-1 {AND last_visit>=NOW() - INTERVAL ?d DAY} ORDER BY last_visit, pass", ($period?$period:DBSIMPLE_SKIP), $clones_count, ($period?$period:DBSIMPLE_SKIP));
	
	$clones=array();
	
	if ($result)
	foreach($result as $clone)
	{
		$clone['pass']=substr($clone['pass'], 0, 6);
		$clones[$clone['ip']][]=$clone;
	}
	
	Tpl::i()->assign('clones', $clones);