Projekt

Obecné

Profil

« Předchozí | Další » 

Revize 1428

Přidáno uživatelem Michal Kliment před více než 12 roky(ů)

Opravdu snad finalne opraven ulogd - za problemy mohlo prevraceny ulogd, ktery ip adresy vracel misto ve formatu A.B.C.D ve formatu D.C.B.A.

Zobrazit rozdíly:

freenetis/branches/testing/application/models/ulog2_ct.php
DECLARE _ip_address VARCHAR (255);
DECLARE _member_id, _is_local, _upload, _download, _local_upload, _local_download INT;
SET _ip_address = INET_NTOA(_orig_ip_saddr);
SET _ip_address = ip2str(_orig_ip_saddr);
SET _upload = _orig_raw_pktlen/1024;
SET _download = _reply_raw_pktlen/1024;
SELECT IF(COUNT(*) > 0, 1, 0) INTO _is_local
FROM local_subnets ls
WHERE INET_ATON(_ip_address) & INET_ATON(netmask) = INET_ATON(network_address);
WHERE (_orig_ip_daddr >> 24 & 255 | _orig_ip_daddr >> 8 & 65280 | _orig_ip_daddr << 8 & 16711680 | _orig_ip_daddr << 24 & 4278190080) & INET_ATON(netmask) = INET_ATON(network_address);
SET _upload = _orig_raw_pktlen/1024;
SET _download = _reply_raw_pktlen/1024;
SET _local_upload = _is_local * _upload;
SET _local_upload = _is_local * _upload;
SET _local_download = _is_local * _download;
SELECT IFNULL(u.member_id, ip.member_id) INTO _member_id
SELECT IFNULL(u.member_id, ip.member_id) INTO _member_id
FROM
(
SELECT ip_address, ip.member_id, IFNULL(i1.device_id, i2.device_id) AS device_id
......
) ip
LEFT JOIN devices d ON ip.device_id = d.id
LEFT JOIN users u ON d.user_id = u.id
WHERE INET_ATON(ip.ip_address) = _orig_ip_saddr;
WHERE ip.ip_address = _ip_address;
INSERT INTO ip_addresses_traffics (ip_address, download, upload, local_download, local_upload, member_id)
VALUES(_ip_address, _download, _upload, _local_download, _local_upload, _member_id)
......
ON DUPLICATE KEY
UPDATE download = download + _download, upload = upload + _upload, local_download = local_download + _local_download, local_upload = local_upload + _local_upload;
RETURN _download;
RETURN _member_id;
END
");
$db->query("DROP FUNCTION IF EXISTS `insert_rand`");
......
{
$user_model = new User_Model();
return ($user_model->function_exists('INSERT_CT') &&
return ($user_model->function_exists('UPDATE_CT') &&
$user_model->function_exists('insert_rand') &&
$user_model->function_exists('ip2str') &&
$user_model->function_exists('swap_endian'));

Také k dispozici: Unified diff