From 006802ab988a6fd7be75d09f00464fd19c903ab7 Mon Sep 17 00:00:00 2001 From: Ermal Date: Fri, 4 Mar 2011 20:15:22 +0000 Subject: * Prevent concurrent logins on CP to not be recorded on the DB. * Make the locking more complex to avoid locking exclusively during pruning task which would hurt a lot CP performance. * Retire the disconnect_client and make all the disconnect functions use the sessionid as identifier. All this was triggered by: http://forum.pfsense.org/index.php/topic,33879.0.html --- usr/local/captiveportal/index.php | 2 +- usr/local/www/status_captiveportal.php | 7 ++++--- usr/local/www/widgets/widgets/captive_portal_status.widget.php | 7 ++++--- 3 files changed, 9 insertions(+), 7 deletions(-) (limited to 'usr/local') diff --git a/usr/local/captiveportal/index.php b/usr/local/captiveportal/index.php index 30dec37..996cdeb 100755 --- a/usr/local/captiveportal/index.php +++ b/usr/local/captiveportal/index.php @@ -122,7 +122,7 @@ setTimeout('window.close();',5000) ; EOD; - disconnect_client($_POST['logout_id']); + captiveportal_disconnect_client($_POST['logout_id']); exit; } else if ($clientmac && $radmac_enable && portal_mac_radius($clientmac,$clientip)) { /* radius functions handle everything so we exit here since we're done */ diff --git a/usr/local/www/status_captiveportal.php b/usr/local/www/status_captiveportal.php index 9560041..8913367 100755 --- a/usr/local/www/status_captiveportal.php +++ b/usr/local/www/status_captiveportal.php @@ -81,9 +81,10 @@ $concurrent = count($cpcontents); foreach ($cpcontents as $cpcontent) { $cpent = explode(",", $cpcontent); + $sessionid = $cpent[5]; if ($_GET['showact']) $cpent[5] = captiveportal_get_last_activity($cpent[2]); - $cpdb[] = $cpent; + $cpdb[$sessionid] = $cpent; } if ($_GET['order']) { if ($_GET['order'] == "ip") @@ -131,7 +132,7 @@ if ($_GET['order']) { - + $cpent): ?>   @@ -141,7 +142,7 @@ if ($_GET['order']) { - ')">"> + ')">"> 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 d240d69..829515f 100644 --- a/usr/local/www/widgets/widgets/captive_portal_status.widget.php +++ b/usr/local/www/widgets/widgets/captive_portal_status.widget.php @@ -68,9 +68,10 @@ $concurrent = count($cpcontents); foreach ($cpcontents as $cpcontent) { $cpent = explode(",", $cpcontent); + $sessionid = $cpent[5]; if ($_GET['showact']) $cpent[5] = captiveportal_get_last_activity($cpent[2]); - $cpdb[] = $cpent; + $cpdb[$sessionid] = $cpent; } if ($_GET['order']) { @@ -97,7 +98,7 @@ if ($_GET['order']) { - + $cpent): ?>   @@ -107,7 +108,7 @@ if ($_GET['order']) { - + -- cgit v1.1