function mactrack_utilities_recreate_aggregated_data() { global $config; if (read_config_option('remove_verification') == 'on' && !isset_request_var('confirm')) { top_header(); form_confirm(__('Are You Sure?'), __('Are you sure you want to delete and recreate all the Aggregated Port to MAC to IP results from the system?'), 'mactrack_utilities.php', 'mactrack_utilities.php?action=mactrack_utilities_recreate_aggregated_data'); bottom_footer(); exit; } if (read_config_option('remove_verification') == '' || isset_request_var('confirm')) { $old_rows = db_fetch_cell('SELECT COUNT(*) FROM mac_track_aggregated_ports'); db_execute('TRUNCATE TABLE mac_track_aggregated_ports'); db_execute('INSERT INTO mac_track_aggregated_ports (site_id, device_id, hostname, device_name, vlan_id, vlan_name, mac_address, vendor_mac, ip_address, dns_hostname, port_number, port_name, date_last, first_scan_date, count_rec, authorized) SELECT site_id, device_id, hostname, device_name, vlan_id, vlan_name, mac_address, vendor_mac, ip_address, dns_hostname, port_number, port_name, max(scan_date), min(scan_date), count(*), authorized FROM mac_track_ports GROUP BY site_id,device_id, mac_address, port_number, ip_address, vlan_id, authorized'); $new_rows = db_fetch_cell('SELECT COUNT(*) FROM mac_track_aggregated_ports'); top_header(); mactrack_utilities(); html_start_box('Device Tracking Database Results', '100%', '', '3', 'center', ''); ?> <td> The following number of records have been removed from the aggergated table: <?php print $old_rows; ?> . And <?php print $new_rows; ?> number of record will be added. </td> <?php html_end_box(); } }
function mactrack_utilities_recreate_aggregated_data() { global $config, $colors; if ((read_config_option("remove_verification") == "on") && (!isset($_GET["confirm"]))) { include("./include/top_header.php"); form_confirm("Are You Sure?", "Are you sure you want to delete and recreate all the Aggregated Port to MAC to IP results from the system?", "mactrack_utilities.php", "mactrack_utilities.php?action=mactrack_utilities_recreate_aggregated_data"); include("./include/bottom_footer.php"); exit; } if ((read_config_option("remove_verification") == "") || (isset($_GET["confirm"]))) { $old_rows = db_fetch_cell("SELECT COUNT(*) FROM mac_track_aggregated_ports"); db_execute("TRUNCATE TABLE mac_track_aggregated_ports"); db_execute("INSERT INTO mac_track_aggregated_ports (site_id, device_id, hostname, device_name, vlan_id, vlan_name, mac_address, vendor_mac, ip_address, dns_hostname, port_number, port_name, date_last, first_scan_date, count_rec, authorized) SELECT site_id, device_id, hostname, device_name, vlan_id, vlan_name, mac_address, vendor_mac, ip_address, dns_hostname, port_number, port_name, max(scan_date), min(scan_date), count(*), authorized FROM mac_track_ports GROUP BY site_id,device_id, mac_address, port_number, ip_address, vlan_id, authorized"); $new_rows = db_fetch_cell("SELECT COUNT(*) FROM mac_track_aggregated_ports"); include("./include/top_header.php"); mactrack_utilities(); html_start_box("<strong>Device Tracking Database Results</strong>", "100%", $colors["header"], "3", "center", ""); ?> <td> The following number of records have been removed from the aggergated table: <?php print $old_rows;?>. And <?php print $new_rows;?> number of record will be added. </td> <?php html_end_box(); } }