• Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Search
  • Register
  • Login
Netgate Discussion Forum
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Search
  • Register
  • Login

Error on Custom Logout page

Captive Portal
3
4
1.7k
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R
    remonboonstra
    last edited by Jul 22, 2015, 8:29 PM

    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 1757

    I 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++){>

    1 Reply Last reply Reply Quote 0
    • G
      Gertjan
      last edited by Jul 23, 2015, 8:55 AM

      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

      No "help me" PM's please. Use the forum, the community will thank you.
      Edit : and where are the logs ??

      1 Reply Last reply Reply Quote 0
      • R
        remonboonstra
        last edited by Jul 27, 2015, 2:59 PM

        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

        1 Reply Last reply Reply Quote 0
        • U
          unixaccent
          last edited by Aug 11, 2015, 8:08 AM Aug 11, 2015, 7:40 AM

          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.

          1 Reply Last reply Reply Quote 0
          • First post
            Last post
          Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.