=".ip2long($cidr_range[0])." and user_auth.ip_int<=".ip2long($cidr_range[1]); } } $enabled_filter=''; if ($enabled>0) { if ($enabled===2) { $enabled_filter = ' and (user_auth.enabled=1 and user_list.enabled=1)'; } if ($enabled===1) { $enabled_filter = ' and (user_auth.enabled=0 or user_list.enabled=0)'; } } $dynamic_filter=''; if ($dynamic_enabled>0) { if ($dynamic_enabled ==1) { $dynamic_filter = ' and user_auth.dynamic=1'; } if ($dynamic_enabled ==2) { $dynamic_filter = ' and user_auth.dynamic=0'; } } $dhcp_filter=''; if ($dhcp_enabled>0) { if ($dhcp_enabled ==1) { $dhcp_filter = ' and user_auth.dhcp=1'; } if ($dhcp_enabled ==2) { $dhcp_filter = ' and user_auth.dhcp=0'; } } if (isset($_POST['search_str'])) { $f_search_str = trim($_POST['search_str']); } if (!isset($f_search_str) and isset($_SESSION[$page_url]['search_str'])) { $f_search_str=$_SESSION[$page_url]['search_str']; } if (!isset($f_search_str)) { $f_search_str=''; } $_SESSION[$page_url]['search_str']=$f_search_str; $f_search=replaceSpecialChars($f_search_str); $ip_list_type_filter=''; if ($ip_type>0) { //suspicious - dhcp not found 3 last days if ($ip_type===3) { $ip_list_type_filter = " and (user_auth.dhcp_action IN ('add', 'old', 'del') and (ABS(user_auth.dhcp_time - user_auth.arp_found)>259200) and (UNIX_TIMESTAMP()-user_auth.arp_found)<259200)"; } //dhcp if ($ip_type===2) { $ip_list_type_filter = " and (user_auth.dhcp_action IN ('add', 'old', 'del'))"; } //static if ($ip_type===1) { $ip_list_type_filter = " and (user_auth.dhcp_action NOT IN ('add', 'old', 'del'))"; } } $ip_where = ''; if (!empty($f_search_str)) { $f_ip = normalizeIpAddress($f_search_str); if (!empty($f_ip)) { $ip_where = " and ip_int=inet_aton('" . $f_ip . "') "; $f_search_str = $f_ip; } else { if (checkValidMac($f_search_str)) { $ip_where =" and mac='" . mac_dotted($f_search_str) ."'"; } else { $ip_where =" and (mac like '" . mac_dotted($f_search) . "%' or login like '".$f_search."%' or description like '".$f_search."%' or dns_name like '".$f_search."%' or dhcp_hostname like '".$f_search."%')"; } } } $ip_list_filter = $ou_filter.$cidr_filter.$enabled_filter.$ip_list_type_filter.$dynamic_filter.$dhcp_filter.$ip_where; print_ip_submenu($page_url); ?>