diff options
-rw-r--r-- | etc/inc/captiveportal.inc | 212 | ||||
-rw-r--r-- | etc/inc/voucher.inc | 4 | ||||
-rw-r--r-- | usr/local/bin/captiveportal_gather_stats.php | 4 | ||||
-rwxr-xr-x | usr/local/www/status_captiveportal.php | 14 | ||||
-rw-r--r-- | usr/local/www/widgets/widgets/captive_portal_status.widget.php | 18 |
5 files changed, 126 insertions, 126 deletions
diff --git a/etc/inc/captiveportal.inc b/etc/inc/captiveportal.inc index 6649cfb..c63e3c9 100644 --- a/etc/inc/captiveportal.inc +++ b/etc/inc/captiveportal.inc @@ -630,63 +630,63 @@ function captiveportal_prune_old() { $timedout = false; $term_cause = 1; - if (empty($cpentry['context'])) - $cpentry['context'] = 'first'; - $radiusservers = $radiussrvs[$cpentry['context']]; + if (empty($cpentry[10])) + $cpentry[10] = 'first'; + $radiusservers = $radiussrvs[$cpentry[10]]; /* hard timeout? */ if ($timeout) { - if (($pruning_time - $cpentry['allow_time']) >= $timeout) { + if (($pruning_time - $cpentry[0]) >= $timeout) { $timedout = true; - $term_cause = RADIUS_TERM_SESSION_TIMEOUT; + $term_cause = 5; // Session-Timeout } } /* Session-Terminate-Time */ - if (!$timedout && !empty($cpentry['session_terminate_time'])) { - if ($pruning_time >= $cpentry['session_terminate_time']) { + if (!$timedout && !empty($cpentry[9])) { + if ($pruning_time >= $cpentry[9]) { $timedout = true; - $term_cause = RADIUS_TERM_SESSION_TIMEOUT; + $term_cause = 5; // Session-Timeout } } /* check if the radius idle_timeout attribute has been set and if its set change the idletimeout to this value */ - $uidletimeout = (is_numeric($cpentry['idle_timeout'])) ? $cpentry['idle_timeout'] : $idletimeout; + $uidletimeout = (is_numeric($cpentry[8])) ? $cpentry[8] : $idletimeout; /* if an idle timeout is specified, get last activity timestamp from ipfw */ if (!$timedout && $uidletimeout > 0) { - $lastact = captiveportal_get_last_activity($cpentry['ip']); + $lastact = captiveportal_get_last_activity($cpentry[2]); /* If the user has logged on but not sent any traffic they will never be logged out. * We "fix" this by setting lastact to the login timestamp. */ - $lastact = $lastact ? $lastact : $cpentry['allow_time']; + $lastact = $lastact ? $lastact : $cpentry[0]; if ($lastact && (($pruning_time - $lastact) >= $uidletimeout)) { $timedout = true; - $term_cause = RADIUS_TERM_IDLE_TIMEOUT; + $term_cause = 4; // Idle-Timeout $stop_time = $lastact; // Entry added to comply with WISPr } } /* if vouchers are configured, activate session timeouts */ - if (!$timedout && isset($vcpcfg['enable']) && !empty($cpentry['session_timeout'])) { - if ($pruning_time >= ($cpentry['allow_time'] + $cpentry['session_timeout'])) { + if (!$timedout && isset($vcpcfg['enable']) && !empty($cpentry[7])) { + if ($pruning_time >= ($cpentry[0] + $cpentry[7])) { $timedout = true; - $term_cause = RADIUS_TERM_SESSION_TIMEOUT; + $term_cause = 5; // Session-Timeout $voucher_needs_sync = true; } } /* if radius session_timeout is enabled and the session_timeout is not null, then check if the user should be logged out */ - if (!$timedout && isset($cpcfg['radiussession_timeout']) && !empty($cpentry['session_timeout'])) { - if ($pruning_time >= ($cpentry['allow_time'] + $cpentry['session_timeout'])) { + if (!$timedout && isset($cpcfg['radiussession_timeout']) && !empty($cpentry[7])) { + if ($pruning_time >= ($cpentry[0] + $cpentry[7])) { $timedout = true; - $term_cause = RADIUS_TERM_SESSION_TIMEOUT; + $term_cause = 5; // Session-Timeout } } if ($timedout) { captiveportal_disconnect($cpentry, $radiusservers,$term_cause,$stop_time); - captiveportal_logportalauth($cpentry['username'], $cpentry['mac'], $cpentry['ip'], "TIMEOUT"); - $unsetindexes[] = $cpentry['sessionid']; + captiveportal_logportalauth($cpentry[4], $cpentry[3], $cpentry[2], "TIMEOUT"); + $unsetindexes[] = $cpentry[5]; } /* do periodic RADIUS reauthentication? */ @@ -694,56 +694,56 @@ function captiveportal_prune_old() { if (isset($cpcfg['radacct_enable'])) { if ($cpcfg['reauthenticateacct'] == "stopstart") { /* stop and restart accounting */ - RADIUS_ACCOUNTING_STOP($cpentry['pipeno'], - $cpentry['username'], - $cpentry['sessionid'], - $cpentry['allow_time'], + RADIUS_ACCOUNTING_STOP($cpentry[1], // ruleno + $cpentry[4], // username + $cpentry[5], // sessionid + $cpentry[0], // start time $radiusservers, - $cpentry['ip'], - $cpentry['mac'], - RADIUS_TERM_NAS_REQUEST); + $cpentry[2], // clientip + $cpentry[3], // clientmac + 10); // NAS Request pfSense_ipfw_Tableaction($cpzone, IP_FW_TABLE_ZERO_ENTRY_STATS, 1, $cpentry[2]); pfSense_ipfw_Tableaction($cpzone, IP_FW_TABLE_ZERO_ENTRY_STATS, 2, $cpentry[2]); - RADIUS_ACCOUNTING_START($cpentry['pipeno'], - $cpentry['username'], - $cpentry['sessionid'], + RADIUS_ACCOUNTING_START($cpentry[1], // ruleno + $cpentry[4], // username + $cpentry[5], // sessionid $radiusservers, - $cpentry['ip'], - $cpentry['mac']); + $cpentry[2], // clientip + $cpentry[3]); // clientmac } else if ($cpcfg['reauthenticateacct'] == "interimupdate") { - $session_time = $pruning_time - $cpentry['allow_time']; - if (!empty($cpentry['interim_interval']) && $cpentry['interim_interval'] > 60) - $interval = $cpentry['interim_interval']; + $session_time = $pruning_time - $cpentry[0]; + if (!empty($cpentry[10]) && $cpentry[10] > 60) + $interval = $cpentry[10]; else $interval = 0; $past_interval_min = ($session_time > $interval); $within_interval = ($session_time % $interval >= 0 && $session_time % $interval <= 59); if (($interval > 0 && $past_interval_min && $within_interval) || $interval === 0) { - RADIUS_ACCOUNTING_STOP($cpentry['pipeno'], - $cpentry['username'], - $cpentry['sessionid'], - $cpentry['allow_time'], + RADIUS_ACCOUNTING_STOP($cpentry[1], // ruleno + $cpentry[4], // username + $cpentry[5], // sessionid + $cpentry[0], // start time $radiusservers, - $cpentry['ip'], - $cpentry['mac'], - 0, - true); // Interim Update + $cpentry[2], // clientip + $cpentry[3], // clientmac + 10, // NAS Request + true); // Interim Updates } } } /* check this user against RADIUS again */ if (isset($cpcfg['reauthenticate'])) { - $auth_list = RADIUS_AUTHENTICATION($cpentry['username'], - base64_decode($cpentry['bpassword']), + $auth_list = RADIUS_AUTHENTICATION($cpentry[4], // username + base64_decode($cpentry[6]), // password $radiusservers, - $cpentry['ip'], - $cpentry['mac'], - $cpentry['pipeno']); + $cpentry[2], // clientip + $cpentry[3], // clientmac + $cpentry[1]); // ruleno if ($auth_list['auth_val'] == 3) { - captiveportal_disconnect($cpentry, $radiusservers, RADIUS_TERM_NAS_REQUEST); - captiveportal_logportalauth($cpentry['username'], $cpentry['mac'], $cpentry['ip'], "RADIUS_DISCONNECT", $auth_list['reply_message']); - $unsetindexes[] = $cpentry['sessionid']; + captiveportal_disconnect($cpentry, $radiusservers, 17); + captiveportal_logportalauth($cpentry[4], $cpentry[3], $cpentry[2], "RADIUS_DISCONNECT", $auth_list['reply_message']); + $unsetindexes[] = $cpentry[5]; } else if ($auth_list['auth_val'] == 2) captiveportal_reapply_attributes($cpentry, $auth_list); } @@ -831,37 +831,37 @@ function captiveportal_disconnect($dbent, $radiusservers,$term_cause = 1,$stop_t /* this client needs to be deleted - remove ipfw rules */ if (isset($config['captiveportal'][$cpzone]['radacct_enable']) && !empty($radiusservers)) { - RADIUS_ACCOUNTING_STOP($dbent['pipeno'], // ruleno - $dbent['username'], - $dbent['sessionid'], - $dbent['allow_time'], + RADIUS_ACCOUNTING_STOP($dbent[1], // ruleno + $dbent[4], // username + $dbent[5], // sessionid + $dbent[0], // start time $radiusservers, - $dbent['ip'], - $dbent['mac'], + $dbent[2], // clientip + $dbent[3], // clientmac $term_cause, // Acct-Terminate-Cause false, $stop_time); } - if (is_ipaddr($dbent['ip'])) { + if (is_ipaddr($dbent[2])) { /* Delete client's ip entry from tables 1 and 2. */ - pfSense_ipfw_Tableaction($cpzone, IP_FW_TABLE_DEL, 1, $dbent['ip']); - pfSense_ipfw_Tableaction($cpzone, IP_FW_TABLE_DEL, 2, $dbent['ip']); + pfSense_ipfw_Tableaction($cpzone, IP_FW_TABLE_DEL, 1, $dbent[2]); + pfSense_ipfw_Tableaction($cpzone, IP_FW_TABLE_DEL, 2, $dbent[2]); /* XXX: Redundant?! Ensure all pf(4) states are killed. */ - pfSense_kill_states($dbent['ip']); - pfSense_kill_srcstates($dbent['ip']); + pfSense_kill_states($dbent[2]); + pfSense_kill_srcstates($dbent[2]); } /* * These are the pipe numbers we use to control traffic shaping for each logged in user via captive portal * We could get an error if the pipe doesn't exist but everything should still be fine */ - if (!empty($dbent['pipeno'])) { - pfSense_pipe_action("pipe delete $dbent[pipeno]"); - pfSense_pipe_action("pipe delete " . ($dbent['pipeno']+1)); + if (!empty($dbent[1])) { + pfSense_pipe_action("pipe delete {$dbent[1]}"); + pfSense_pipe_action("pipe delete " . ($dbent[1]+1)); /* Release the ruleno so it can be reallocated to new clients. */ - captiveportal_free_dn_ruleno($dbent['pipeno']); + captiveportal_free_dn_ruleno($dbent[1]); } // XMLRPC Call over to the master Voucher node @@ -889,10 +889,10 @@ function captiveportal_disconnect_client($sessionid, $term_cause = 1, $logoutRea captiveportal_write_db("DELETE FROM captiveportal WHERE sessionid = '{$sessionid}'"); foreach ($result as $cpentry) { - if (empty($cpentry['context'])) - $cpentry['context'] = 'first'; - captiveportal_disconnect($cpentry, $radiusservers[$cpentry['context']], $term_cause); - captiveportal_logportalauth($cpentry['username'], $cpentry['mac'], $cpentry['ip'], "DISCONNECT"); + if (empty($cpentry[10])) + $cpentry[10] = 'first'; + captiveportal_disconnect($cpentry, $radiusservers[$cpentry[10]], $term_cause); + captiveportal_logportalauth($cpentry[4], $cpentry[3], $cpentry[2], "DISCONNECT"); } unset($result); } @@ -909,17 +909,17 @@ function captiveportal_radius_stop_all() { if (!empty($radiusservers)) { $cpdb = captiveportal_read_db(); foreach ($cpdb as $cpentry) { - if (empty($cpentry['context'])) - $cpentry['context'] = 'first'; - if (!empty($radiusservers[$cpentry['context']])) { - RADIUS_ACCOUNTING_STOP($cpentry['pipeno'], - $cpentry['username'], - $cpentry['sessionid'], - $cpentry['allow_time'], - $radiusservers[$cpentry['context']], - $cpentry['ip'], - $cpentry['mac'], - RADIUS_TERM_NAS_REBOOT); + if (empty($cpentry[10])) + $cpentry[10] = 'first'; + if (!empty($radiusservers[$cpentry[10]])) { + RADIUS_ACCOUNTING_STOP($cpentry[1], // ruleno + $cpentry[4], // username + $cpentry[5], // sessionid + $cpentry[0], // start time + $radiusservers[$cpentry[10]], + $cpentry[2], // clientip + $cpentry[3], // clientmac + 7); // Admin Reboot } } } @@ -1234,7 +1234,7 @@ function captiveportal_opendb() { else { $errormsg = ""; $DB = @sqlite_open("{$g['vardb_path']}/captiveportal{$cpzone}.db"); - if (@sqlite_exec($DB, "CREATE TABLE captiveportal (allow_time INTEGER, pipeno INTEGER, ip TEXT, mac TEXT, username TEXT, sessionid TEXT, bpassword TEXT, session_timeout INTEGER, idle_timeout INTEGER, session_terminate_time INTEGER, interim_interval INTEGER, context TEXT) ", $errormsg)) { + if (@sqlite_exec($DB, "CREATE TABLE captiveportal (allow_time INTEGER, pipeno INTEGER, ip TEXT, mac TEXT, username TEXT, sessionid TEXT, bpassword TEXT, session_timeout INTEGER, idle_timeout INTEGER, session_terminate_time INTEGER, interim_interval INTEGER) ", $errormsg)) { @sqlite_exec($DB, "CREATE UNIQUE INDEX idx_active ON captiveportal (sessionid, username)"); @sqlite_exec($DB, "CREATE INDEX user ON captiveportal (username)"); @sqlite_exec($DB, "CREATE INDEX ip ON captiveportal (ip)"); @@ -1254,10 +1254,10 @@ function captiveportal_read_db($query = "") { if ($DB) { sqlite_exec($DB, "BEGIN"); if (!empty($query)) - $cpdb = @sqlite_array_query($DB, "SELECT * FROM captiveportal {$query}"); + $cpdb = @sqlite_array_query($DB, "SELECT * FROM captiveportal {$query}", SQLITE_NUM); else { - $response = @sqlite_unbuffered_query($DB, "SELECT * FROM captiveportal"); - $cpdb = @sqlite_fetch_all($response); + $response = @sqlite_unbuffered_query($DB, "SELECT * FROM captiveportal", SQLITE_NUM); + $cpdb = @sqlite_fetch_all($response, SQLITE_NUM); } sqlite_exec($DB, "END"); @sqlite_close($DB); @@ -1691,8 +1691,8 @@ function captiveportal_reapply_attributes($cpentry, $attributes) { $dwfaultbw_down = isset($config['captiveportal'][$cpzone]['bwdefaultdn']) ? $config['captiveportal'][$cpzone]['bwdefaultdn'] : 0; $bw_up = isset($attributes['bw_up']) ? round(intval($attributes['bw_up'])/1000, 2) : $dwfaultbw_up; $bw_down = isset($attributes['bw_down']) ? round(intval($attributes['bw_down'])/1000, 2) : $dwfaultbw_down; - $bw_up_pipeno = $cpentry['pipeno']; - $bw_down_pipeno = $cpentry['pipeno']+1; + $bw_up_pipeno = $cpentry[1]; + $bw_down_pipeno = $cpentry[1]+1; pfSense_pipe_action("pipe {$bw_up_pipeno} config bw {$bw_up}Kbit/s queue 100 buckets 16"); pfSense_pipe_action("pipe {$bw_down_pipeno} config bw {$bw_down}Kbit/s queue 100 buckets 16"); @@ -1776,37 +1776,37 @@ function portal_allow($clientip,$clientmac,$username,$password = null, $attribut $radiusctx = 'first'; foreach ($cpdb as $cpentry) { - if (empty($cpentry['context'])) - $cpentry['context'] = 'first'; + if (empty($cpentry[10])) + $cpentry[10] = 'first'; /* on the same ip */ - if ($cpentry['ip'] == $clientip) { - if (isset($config['captiveportal'][$cpzone]['nomacfilter']) || $cpentry['mac'] == $clientmac) - captiveportal_logportalauth($cpentry['username'],$cpentry['mac'],$cpentry['ip'],"CONCURRENT LOGIN - REUSING OLD SESSION"); + if ($cpentry[2] == $clientip) { + if (isset($config['captiveportal'][$cpzone]['nomacfilter']) || $cpentry[3] == $clientmac) + captiveportal_logportalauth($cpentry[4],$cpentry[3],$cpentry[2],"CONCURRENT LOGIN - REUSING OLD SESSION"); else - captiveportal_logportalauth($cpentry['username'],$cpentry['mac'],$cpentry['ip'],"CONCURRENT LOGIN - REUSING IP $cpentry[ip] WITH DIFFERENT MAC ADDRESS $cpentry[mac]"); - $sessionid = $cpentry['sessionid']; + captiveportal_logportalauth($cpentry[4],$cpentry[3],$cpentry[2],"CONCURRENT LOGIN - REUSING IP {$cpentry[2]} WITH DIFFERENT MAC ADDRESS {$cpentry[3]}"); + $sessionid = $cpentry[5]; break; } - elseif (($attributes['voucher']) && ($username != 'unauthenticated') && ($cpentry['username'] == $username)) { + elseif (($attributes['voucher']) && ($username != 'unauthenticated') && ($cpentry[4] == $username)) { // user logged in with an active voucher. Check for how long and calculate // how much time we can give him (voucher credit - used time) - $remaining_time = $cpentry['allow_time'] + $cpentry['session_timeout'] - $allow_time; - if ($remaining_time < 0) // just in case. + $remaining_time = $cpentry[0] + $cpentry[7] - $allow_time; + if ($remaining_time < 0) // just in case. $remaining_time = 0; /* This user was already logged in so we disconnect the old one */ - captiveportal_disconnect($cpentry,$radiusservers[$cpentry['context']],RADIUS_TERM_PORT_PREEMPTED); - captiveportal_logportalauth($cpentry['username'],$cpentry['mac'],$cpentry['ip'],"CONCURRENT LOGIN - TERMINATING OLD SESSION"); - $unsetindexes[] = $cpentry['sessionid']; + captiveportal_disconnect($cpentry,$radiusservers[$cpentry[10]],13); + captiveportal_logportalauth($cpentry[4],$cpentry[3],$cpentry[2],"CONCURRENT LOGIN - TERMINATING OLD SESSION"); + $unsetindexes[] = $cpentry[5]; break; } elseif ((isset($config['captiveportal'][$cpzone]['noconcurrentlogins'])) && ($username != 'unauthenticated')) { /* on the same username */ - if (strcasecmp($cpentry['username'], $username) == 0) { + if (strcasecmp($cpentry[4], $username) == 0) { /* This user was already logged in so we disconnect the old one */ - captiveportal_disconnect($cpentry,$radiusservers[$cpentry['context']],RADIUS_TERM_PORT_PREEMPTED); - captiveportal_logportalauth($cpentry['username'],$cpentry['mac'],$cpentry['ip'],"CONCURRENT LOGIN - TERMINATING OLD SESSION"); - $unsetindexes[] = $cpentry['sessionid']; + captiveportal_disconnect($cpentry,$radiusservers[$cpentry[10]],13); + captiveportal_logportalauth($cpentry[4],$cpentry[3],$cpentry[2],"CONCURRENT LOGIN - TERMINATING OLD SESSION"); + $unsetindexes[] = $cpentry[5]; break; } } @@ -1895,9 +1895,9 @@ function portal_allow($clientip,$clientmac,$username,$password = null, $attribut /* encode password in Base64 just in case it contains commas */ $bpassword = base64_encode($password); - $insertquery = "INSERT INTO captiveportal (allow_time, pipeno, ip, mac, username, sessionid, bpassword, session_timeout, idle_timeout, session_terminate_time, interim_interval, context) "; + $insertquery = "INSERT INTO captiveportal (allow_time, pipeno, ip, mac, username, sessionid, bpassword, session_timeout, idle_timeout, session_terminate_time, interim_interval) "; $insertquery .= "VALUES ({$allow_time}, {$pipeno}, '{$clientip}', '{$clientmac}', '{$safe_username}', '{$sessionid}', '{$bpassword}', "; - $insertquery .= "{$session_timeout}, {$idle_timeout}, {$session_terminate_time}, {$interim_interval}, '{$radiusctx}')"; + $insertquery .= "{$session_timeout}, {$idle_timeout}, {$session_terminate_time}, {$interim_interval})"; /* store information to database */ captiveportal_write_db($insertquery); diff --git a/etc/inc/voucher.inc b/etc/inc/voucher.inc index 4232289..5b392bb 100644 --- a/etc/inc/voucher.inc +++ b/etc/inc/voucher.inc @@ -257,8 +257,8 @@ function voucher_expire($voucher_received) { $cpentry = captiveportal_read_db("WHERE username = '{$voucher}'"); if (!empty($cpentry)) { captiveportal_disconnect($cpentry,null,13); - captiveportal_logportalauth($cpentry['username'],$cpentry['mac'],$cpentry['ip'],"FORCLY TERMINATING VOUCHER {$voucher} SESSION"); - $unsetindexes[] = $cpentry['sessionid']; + captiveportal_logportalauth($cpentry[4],$cpentry[3],$cpentry[2],"FORCLY TERMINATING VOUCHER {$voucher} SESSION"); + $unsetindexes[] = $cpentry[5]; } } else captiveportal_syslog("$voucher ($roll/$nr): not found on any registererd Roll"); diff --git a/usr/local/bin/captiveportal_gather_stats.php b/usr/local/bin/captiveportal_gather_stats.php index 3ff03dd..63d91a2 100644 --- a/usr/local/bin/captiveportal_gather_stats.php +++ b/usr/local/bin/captiveportal_gather_stats.php @@ -77,9 +77,9 @@ if ($type == "loggedin") { @fclose($fd); foreach($cpdb as $user) { - $user_ip = $user['ip']; + $user_ip = $user[2]; // Record the timestamp - $timestamp = $user['allow_time']; + $timestamp = $user[0]; if ($timestamp > $previous_user_timestamp) $current_user_count = $current_user_count + 1; } diff --git a/usr/local/www/status_captiveportal.php b/usr/local/www/status_captiveportal.php index 15a2227..2e303b6 100755 --- a/usr/local/www/status_captiveportal.php +++ b/usr/local/www/status_captiveportal.php @@ -50,7 +50,7 @@ if (isset($_POST['zone'])) $cpzone = $_POST['zone']; if ($_GET['act'] == "del" && !empty($cpzone)) { - captiveportal_disconnect_client($_GET['id'], RADIUS_TERM_ADMIN_RESET); + captiveportal_disconnect_client($_GET['id']); Header("Location: status_captiveportal.php?zone={$cpzone}"); exit; } @@ -156,16 +156,16 @@ if (!empty($cpzone)) { </tr> <?php foreach ($cpdb as $cpent): ?> <tr> - <td class="listlr"><?=$cpent['ip'];?></td> - <td class="listr"><?=$cpent['mac'];?> </td> - <td class="listr"><?=$cpent['username'];?> </td> - <td class="listr"><?=htmlspecialchars(date("m/d/Y H:i:s", $cpent['allow_time']));?></td> + <td class="listlr"><?=$cpent[2];?></td> + <td class="listr"><?=$cpent[3];?> </td> + <td class="listr"><?=$cpent[4];?> </td> + <td class="listr"><?=htmlspecialchars(date("m/d/Y H:i:s", $cpent[0]));?></td> <?php if ($_GET['showact']): - $last_act = captiveportal_get_last_activity($cpent['ip']); ?> + $last_act = captiveportal_get_last_activity($cpent[2]); ?> <td class="listr"><?php if ($last_act != 0) echo htmlspecialchars(date("m/d/Y H:i:s", $last_act));?></td> <?php endif; ?> <td valign="middle" class="list" nowrap> - <a href="?zone=<?=$cpzone;?>&order=<?=$_GET['order'];?>&showact=<?=htmlspecialchars($_GET['showact']);?>&act=del&id=<?=$cpent['sessionid'];?>" onclick="return confirm('<?=gettext("Do you really want to disconnect this client?");?>')"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_x.gif" width="17" height="17" border="0" title="<?=gettext("Disconnect");?>"></a></td> + <a href="?zone=<?=$cpzone;?>&order=<?=$_GET['order'];?>&showact=<?=htmlspecialchars($_GET['showact']);?>&act=del&id=<?=$cpent[5];?>" onclick="return confirm('<?=gettext("Do you really want to disconnect this client?");?>')"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_x.gif" width="17" height="17" border="0" title="<?=gettext("Disconnect");?>"></a></td> </tr> <?php endforeach; endif; ?> </table> diff --git a/usr/local/www/widgets/widgets/captive_portal_status.widget.php b/usr/local/www/widgets/widgets/captive_portal_status.widget.php index 1393fc0..2db0a2a 100644 --- a/usr/local/www/widgets/widgets/captive_portal_status.widget.php +++ b/usr/local/www/widgets/widgets/captive_portal_status.widget.php @@ -46,7 +46,7 @@ require_once("captiveportal.inc"); if (($_GET['act'] == "del") && (!empty($_GET['zone']))) { $cpzone = $_GET['zone']; - captiveportal_disconnect_client($_GET['id'], RADIUS_TERM_ADMIN_RESET); + captiveportal_disconnect_client($_GET['id']); } flush(); @@ -65,9 +65,9 @@ $cpdb_all = array(); foreach ($a_cp as $cpzone => $cp) { $cpdb = captiveportal_read_db(); foreach ($cpdb as $cpent) { - $cpent['zone'] = $cpzone; + $cpent[10] = $cpzone; if ($_GET['showact']) - $cpent['lastactivity'] = captiveportal_get_last_activity($cpent['ip']); + $cpent[11] = captiveportal_get_last_activity($cpent[2]); $cpdb_all[] = $cpent; } } @@ -100,15 +100,15 @@ if ($_GET['order']) { </tr> <?php foreach ($cpdb_all as $cpent): ?> <tr> - <td class="listlr"><?=$cpent['ip'];?></td> - <td class="listr"><?=$cpent['mac'];?> </td> - <td class="listr"><?=$cpent['username'];?> </td> + <td class="listlr"><?=$cpent[2];?></td> + <td class="listr"><?=$cpent[3];?> </td> + <td class="listr"><?=$cpent[4];?> </td> <?php if ($_GET['showact']): ?> - <td class="listr"><?=htmlspecialchars(date("m/d/Y H:i:s", $cpent['allow_time']));?></td> - <td class="listr"><?php if ($cpent['lastactivity'] && ($cpent['lastactivity'] > 0)) echo htmlspecialchars(date("m/d/Y H:i:s", $cpent['lastactivity']));?></td> + <td class="listr"><?=htmlspecialchars(date("m/d/Y H:i:s", $cpent[0]));?></td> + <td class="listr"><?php if ($cpent[11] && ($cpent[11] > 0)) echo htmlspecialchars(date("m/d/Y H:i:s", $cpent[11]));?></td> <?php endif; ?> <td valign="middle" class="list" nowrap> - <a href="?order=<?=$_GET['order'];?>&showact=<?=$_GET['showact'];?>&act=del&zone=<?=$cpent['zone'];?>&id=<?=$cpent['sessionid'];?>" onclick="return confirm('Do you really want to disconnect this client?')"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_x.gif" width="17" height="17" border="0"></a></td> + <a href="?order=<?=$_GET['order'];?>&showact=<?=$_GET['showact'];?>&act=del&zone=<?=$cpent[10];?>&id=<?=$cpent[5];?>" onclick="return confirm('Do you really want to disconnect this client?')"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_x.gif" width="17" height="17" border="0"></a></td> </tr> <?php endforeach; ?> </table> |