Error on Custom Logout page
-
Hello all,
I created a, working, solution for our users to manually logout if they logon to their second/third/fourth/etc.. device.
They will be shown a list of client devices (ip addresses) and they select one to be logged out, I used the default logout code from the default logout popup window.As I don't wanna modify the core files, I made this all work with the default 'Error page'.
Most important things done:
/* code */
global $cpzone, $cpzoneid;
$cpzone = $_REQUEST['zone'];
$cpcfg = $config['captiveportal'][$cpzone];$cpzoneid = $cpcfg['zoneid'];
$orig_host = $_SERVER['HTTP_HOST'];
/* NOTE: IE 8/9 is buggy and that is why this is needed */
$orig_request = trim($_REQUEST['redirurl'], " /");
$clientip = $_SERVER['REMOTE_ADDR'];
$username = $_REQUEST['auth_user'];
$password = $_REQUEST['auth_pass'];
$bpassword = base64_encode($password);// Search for entries in CP db.
$cpdb = captiveportal_read_db("WHERE username='{$username}' AND bpassword='{$bpassword}'");/* code for layout */
if (count($cpdb) == 1) {
// single entry and failure means, a user can only logon once.
// Action: disconnect user and let them login again.
captiveportal_disconnect_client($cpdb[0]['sessionid'], 1, $logoutReason = "User LOGOUT - on First device !!");
echo "Other device disconnected, you can logon again!
";
} else {
// multiple entries found, meaning user has to choose which session to kill.
for ($i=0; $i <count($cpdb);$i++){ <br="">if ($i==0) { echo "choose your device to disconnect:
"; }
?>
/* code for layout *//* code for layout */
/* code for layout */
The issue I'm having is that the bold line results in the following error (first time):
Failed setsockopt
Second time(meaning the user is logged out I think):
Failed setsockoptFailed setsockopt Warning: Cannot modify header information - headers already sent by (output started at /etc/inc/captiveportal.inc:2015) in /etc/inc/captiveportal.inc on line 1757I tried a lot to get this fixed, but can't seem to pinpoint the real issue here.
Anybody got any idea why I keep getting this issue?
Thank you!
Remon</count($cpdb);$i++){>
-
This one:
@remonboonstra:The issue I'm having is that the bold line results in the following error (first time):
Failed setsockopt
….Check with what has been said here : https://forum.pfsense.org/index.php?topic=94341.msg524502#msg524502
-
Hi Gertjan,
thank you for your reply, I searched the forum, did not found this (your) reply as you' re pointing out.
This helped me solve the puzzle!Thanks,
Remon
-
Hi Everyone,
I have been looking for a custom logout page for 2.2.4 but I could not find one. What I've been using in my setup is this tutorial but it is only usable only for 2.1.5 "https://www.youtube.com/watch?v=xk60lg-9o3A". Can you share some ideas on this?
Thank you.