function format_mac($str, $delim = '-', $case = 'lower') { if (is_mac($str)) { $str = join($delim, str_split($str, 2)); $str = $case == 'upper' ? strtoupper($str) : strtolower($str); } return $str; }
if ($cpcontents) { foreach ($cpcontents as $cpcontent) { $cpent = explode(",", $cpcontent); $mac_dash = str_replace(':', '-', $cpent[3]); if ($mac_dash == $mac_addr) { $usession = $cpent[5]; $ufound = true; break; } } /* Logout the user from captiveportal */ if ($ufound) { captiveportal_disconnect_client($usession); } } if (!is_mac($mac_addr)) { $input_errors[] = "'{$mac_addr}' geçerli bir MAC adresi değil."; $macError = true; } if (strlen($description) > 60) { $input_errors[] = 'Açıklama uzunluğu 60 karakteri geçmemelidir.'; } if (!$macError) { /* Check if MAC exists */ $checkMac = $pdo->prepare("\n\t\t\t\tSELECT mac_addr\n\t\t\t\tFROM blocklist\n\t\t\t\tWHERE mac_addr = :mac\n\t\t\t"); $checkMac->bindParam(':mac', $mac_addr); $checkMac->execute(); $macFound = $checkMac->fetch(PDO::FETCH_ASSOC); } if ($macFound && $macFound['mac_addr'] != $currentmac) { $input_errors[] = "'{$mac_addr}' MAC adresi zaten engellenmiş.";
function detect_browser($link_id, $UA = "") { // Determine the platform [0], browser name[1] and version[2] if ($UA == "") { $UA = getenv('HTTP_USER_AGENT'); } $output = array(); $output[0] = ""; $output[1] = ""; $output[2] = ""; // Check for windows if (strstr($UA, 'Win') || strstr($UA, '16bit') || strstr($UA, '95') || strstr($UA, '4.9')) { $output[0] = is_win($UA); } elseif (strstr($UA, 'Mac') || strstr($UA, 'apple') || strstr($UA, '68')) { $output[0] = is_mac($UA); } else { $output[0] = is_other($UA); } // Now check for browser and version if (strstr($UA, "Mozilla")) { // Mozilla based browser if (strstr($UA, "ANTFresco")) { $match = "//"; $output[1] = "Bush Internet"; $output[2] = get_version($UA, $match, 0); } elseif (strstr($UA, "Multiphone")) { $match = "//"; $output[1] = "Multiphone"; $output[2] = get_version($UA, $match, 0); } elseif (strstr($UA, "Konqueror")) { $match = "//"; $output[1] = "Konqueror"; $output[2] = get_version($UA, $match, 0); } elseif (strstr($UA, "MSIE")) { $match = "/MSIE ([1-9]\\.[0-9]{1,2})/"; $output[1] = "Internet Explorer"; $output[2] = get_version($UA, $match, 1); } elseif (strstr($UA, "MS Front")) { $output[1] = "Internet Explorer"; $output[2] = "4.0"; $output[0] = "Windows (32-bit)"; } elseif (strstr($UA, "MSPIE")) { $match = "/MSPIE ([1-9]\\.[0-9])/"; $output[1] = "Pocket Internet Explorer"; $output[2] = get_version($UA, $match, 1); } elseif (strstr($UA, "IWENG")) { $match = "//"; $output[1] = "AOL browser"; $output[2] = get_version($UA, $match, 0); } elseif (strstr($UA, "aol")) { $match = "//"; $output[1] = "AOL browser"; $output[2] = get_version($UA, $match, 0); } elseif (strstr($UA, "PowerBrowser")) { $match = "//"; $output[1] = "Oracle PowerBrowser"; $output[2] = get_version($UA, $match, 0); } elseif (strstr($UA, "Opera")) { $match = "//"; $output[1] = "Opera"; $output[2] = get_version($UA, $match, 0); } elseif (strstr($UA, "WebTV") && strstr($UA, "MSIE")) { $match = "//"; $output[1] = "WebTV"; $output[2] = get_version($UA, $match, 0); } elseif (strstr($UA, "Dreamcast")) { $match = "//"; $output[1] = "Dreamcast"; $output[2] = get_version($UA, $match, 0); } elseif (strstr($UA, "iCAB")) { $match = "//"; $output[1] = "iCAB"; $output[2] = get_version($UA, $match, 0); } elseif (strstr($UA, "CJPENNYCATE")) { $match = "//"; $output[1] = "Web2U"; $output[2] = get_version($UA, $match, 0); } elseif (strstr($UA, "AOLTV")) { $match = "//"; $output[1] = "AolTV"; $output[2] = get_version($UA, $match, 0); } elseif (strstr($UA, "Netbox")) { $match = "//"; $output[1] = "Netgen"; $output[2] = get_version($UA, $match, 0); } elseif (strstr($UA, "compatible")) { $match = "/MSIE ([1-9]\\.[0-9])/"; $output[1] = "Internet Explorer"; $output[2] = get_version($UA, $match, 1); } else { // No other matches so it must be some form of Netscape $match = "/Mozilla\\/([0-9].[0-9]{1,2})/"; $output[1] = "Netscape"; $output[2] = get_version($UA, $match, 1); } } else { // Non-Mozilla based browsers // // NEED TO CHECK TO SEE IF IT IS A ROBOT if (strstr($UA, "Internet Explorer") && !strstr($UA, "Pocket")) { $match = "/Explorer\\/4/"; $output[1] = "Internet Explorer"; $output[2] = "4.0 (beta)"; } elseif (strstr($UA, "Pocket")) { $match = "/Explorer\\/([0-9]\\.[0-9])/"; $output[1] = "Pocket Internet Explorer"; $output[2] = get_version($UA, $match, 1); $output[0] = "Windows CE"; } elseif (strstr($UA, "lynx") || strstr($UA, "libwww")) { $match = "//"; $output[1] = "Lynx"; $output[2] = get_version($UA, $match, 0); } elseif (strstr($UA, "Mosaic")) { $match = "//"; $output[1] = "NCSA Mosaic"; $output[2] = get_version($UA, $match, 0); } elseif (strstr($UA, "PRODIGY")) { $match = "//"; $output[1] = "Prodigy"; $output[2] = get_version($UA, $match, 0); } elseif (strstr($UA, "HotJava")) { $match = "//"; $output[1] = "HotJava"; $output[2] = get_version($UA, $match, 0); } elseif (strstr($UA, "IBrowse")) { $match = "//"; $output[1] = "IBrowse"; $output[2] = get_version($UA, $match, 0); } elseif (strstr($UA, "IBrowse")) { $match = "//"; $output[1] = "WebExplorer"; $output[2] = get_version($UA, $match, 0); } elseif (strstr($UA, "IBM-WebExplorer")) { $match = "//"; $output[1] = "IBM-WebExplorer"; } elseif (strstr($UA, "MacWeb")) { $match = "//"; $output[1] = "MacWeb"; $output[2] = get_version($UA, $match, 0); } elseif (strstr($UA, "Cyberdog")) { $match = "//"; $output[1] = "Cyberdog"; $output[2] = get_version($UA, $match, 0); } elseif (strstr($UA, "Amiga")) { $match = "//"; $output[1] = "Amiga Voyager"; $output[2] = get_version($UA, $match, 0); } elseif (strstr($UA, "ANT")) { $match = "//"; $output[1] = "ANT-Fresco"; $output[2] = get_version($UA, $match, 0); } elseif (strstr($UA, "Blazer")) { $match = "//"; $output[1] = "Blazer"; $output[2] = get_version($UA, $match, 0); } } // Check to see if we need to store UA in database if (empty($output[0]) || empty($output[1]) || empty($output[2])) { store_unknown($link_id, $UA); } // Check for empty values and set them to 'unknown' if found if (empty($output[0])) { $output[0] = "unknown"; } if (empty($output[1])) { $output[1] = "unknown"; } if (empty($output[2])) { $output[2] = "unknown"; } return $output; }
Copyright (C) 2013-2015 Ogün AÇIK All rights reserved. */ require 'guiconfig.inc'; require 'captiveportal.inc'; require 'local_connection.inc'; $pgtitle = array('HOTSPOT ', 'ÖZEL İZİNLİ MAC ADRESLERİ'); /* Get active captiveportal sessions */ if (file_exists("{$g['vardb_path']}/captiveportal.db")) { $captiveportallck = lock('captiveportaldb'); $cpcontents = file("{$g['vardb_path']}/captiveportal.db", FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES); unlock($captiveportallck); } if ($connection) { if ($_GET['act'] == 'del' && is_mac($_GET['mac'])) { $mac_addr = $_GET['mac']; $findMac = $pdo->prepare("\n\t\t\tSELECT username FROM radcheck\n\t\t\tWHERE username = :mac\n\t\t"); $findMac->bindParam(':mac', $mac_addr); $findMac->execute(); $macExists = $findMac->fetch(PDO::FETCH_ASSOC); if ($macExists) { /* Delete from radcheck table */ $delmac = $pdo->prepare("\n\t\t\t\tDELETE FROM radcheck\n\t\t\t\tWHERE username = :mac\n\t\t\t"); $delmac->bindParam(':mac', $mac_addr); $delmac->execute(); /* Check user whether if logged in captiveportal */ if (isset($cpcontents)) { foreach ($cpcontents as $cpcontent) { $cpent = explode(",", $cpcontent); if ($cpent[4] == $mac_addr) {
?> <?php if ($input_errors) { print_input_errors($input_errors); } ?> <?php flush(); foreach ($cpcontents as $cpcontent) { $cpent = explode(',', $cpcontent); $sessionid = $cpent[5]; $cpent[3] = str_replace(':', '-', $cpent[3]); $cpent[5] = captiveportal_get_last_activity($cpent[2]); if (is_mac($cpent[4])) { $cpent[10] = 'label-success'; } $cpdb[$sessionid] = $cpent; } ?> <table cellpadding="0" cellspacing="0"> <tr> <td class='tabnavtbl'> <?php $tab_array = array(); $tab_array[] = array('Aktif Oturumlar', true, 'hotspot_status.php'); $tab_array[] = array('Yerel Kullanıcılar', false, 'hotspot_users.php'); $tab_array[] = array('Özel İzinli MAC Adresleri', false, 'hotspot_macs.php'); $tab_array[] = array('Engellenmiş MAC Adresleri', false, 'hotspot_blocklist.php'); $tab_array[] = array('Oturum Hareketleri', false, 'hotspot_logs.php');