Ignore:
Timestamp:
10/03/2009 02:39:59 PM (3 years ago)
Author:
Acinonyx
Message:

[awmn] Fix undefined offset errors, replace correct_ip* functions with ip_to_ranges

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/awmn/includes/pages/ranges/ranges_search.php

    r201 r207  
    4343                $where = $form_search_ranges->db_data_where(array('ip' => 'exclude')); 
    4444                $table_ip_ranges = new table(array('TABLE_NAME' => 'table_ip_ranges', 'FORM_NAME' => 'table_ip_ranges')); 
    45                 $s_ip = $form_search_ranges->data[0]['value']; 
    4645                $where = ($where !=''?"(".$where.") AND ":""); 
    47                 if ($s_ip !='') $where .= '(ip_ranges.ip_start >= '.ip2long(correct_ip_min($s_ip, TRUE, 1)).' AND ip_ranges.ip_start <= '.ip2long(correct_ip_max($s_ip, TRUE, 1)).") OR ". 
    48                                                 '(ip_ranges.ip_start >= '.ip2long(correct_ip_min($s_ip, TRUE, 2)).' AND ip_ranges.ip_start <= '.ip2long(correct_ip_max($s_ip, TRUE, 2)).") OR ". 
    49                                                 '(ip_ranges.ip_start >= '.ip2long(correct_ip_min($s_ip, TRUE, 3)).' AND ip_ranges.ip_start <= '.ip2long(correct_ip_max($s_ip, TRUE, 3)).") AND "; 
    50                 //$where =  
    51                 //              ($s_ip !=''?"ip_ranges.ip_start <= ".ip2long($s_ip)." AND ip_ranges.ip_end >= ".ip2long($s_ip)." AND ":""); 
     46                if ($form_search_ranges->data[0]['value'] != '') { 
     47                        $where .= "("; 
     48                        $s_ranges = ip_to_ranges($form_search_ranges->data[0]['value']); 
     49                        foreach ($s_ranges as $s_range) { 
     50                                $where .= "(ip_ranges.ip_start BETWEEN ".ip2long($s_range['min'])." AND ".ip2long($s_range['max']).") OR "; 
     51                        } 
     52                        $where = substr($where, 0, -4).") AND "; 
     53                } 
    5254                if ($where!='') $where = substr($where, 0, -5); 
    5355                $table_ip_ranges->db_data( 
     
    7981                $this->tpl['link_ranges_search'] = makelink(array("page" => "ranges", "subpage" => "search")); 
    8082                $this->tpl['link_ranges_allocation'] = makelink(array("page" => "ranges", "subpage" => "allocation")); 
    81                 $form_search_ranges = $this->form_search_ranges(); 
    82                 //if ($form_search_ranges->data[0]['value'] != '') $form_search_ranges->data[0]['value'] = correct_ip($form_search_ranges->data[0]['value']); 
    83                 $this->tpl['form_search_ranges'] = $construct->form($form_search_ranges, __FILE__); 
     83                $this->tpl['form_search_ranges'] = $construct->form($this->form_search_ranges(), __FILE__); 
    8484                $this->tpl['table_ranges'] = $construct->table($this->table_ip_ranges(), __FILE__); 
    8585                return template($this->tpl, __FILE__); 
Note: See TracChangeset for help on using the changeset viewer.