Пример #1
0
	static function cloneLastCameFrom($camefrom=0, $qtd=-1){	//Retorna um array com os ultimos usuarios que vieram de camefrom
		global $CONF;

		if ($qtd<=0) $qtd=$CONF['user_list_qt'];

		$addwhere='';
		if ($camefrom>=0)
			$addwhere.=" AND camefrom in ($camefrom)";

		$db = clone $GLOBALS['maindb'];
		$db->query("SELECT *,ceil( (2^(bancounter-1)*${CONF['ban_time']} + extract (epoch from lastban_time) - extract (epoch from now()))/60 ) as banned FROM vw_user WHERE 1=1 {$addwhere} ORDER BY date desc LIMIT $qtd;");

		if ($db->number_rows()<=0) return null;

		$stArr = array($db->number_rows());

		$i = 0;
		while ($row = $db->fetch())
		{
			$tmp = new RegUser();
			$tmp->constructFromRow($row);
			$stArr[$i]=$tmp;
			$i++;
		}
		return $stArr;
	}