Custom logout page

  • Hello everyone,

    I'm looking for a way to disconnect a user via an url, so i'm searching for a php page or an html page that could log a user out from opening it.

    Something like http://mypfsense:8002/logout.html, and then user launching it is directy diconnected.

    I did some research throught the Web, but nothing could help me.
    I know bearly nothing in coding...

    So if someone has written such script and would give it to the community, it would be very much appreciate.

    Thank you for your help

  • Thanks to @Gertjan
    Here is the code to have a proper logout.php page :



    global $g, $config, $cpzone, $cpzoneid;

    /* Are there any portals ? /
    if (is_array($config['captiveportal'])) {
    For every portal (cpzone), do /
    foreach ($config['captiveportal'] as $cpkey => $cp)
    Sanity check /
    if (is_array($config['captiveportal'][$cpkey]))
    Is zone enabled ? */
    if (array_key_exists('enable', $config['captiveportal'][$cpkey])) {
    $cpzone = $cpkey;
    $cpzoneid = $cp['zoneid'];
    $client_ip = $_SERVER['REMOTE_ADDR'];
    $cpentry = array();
    $cpentry = captiveportal_isip_logged($client_ip);
    if ( array_key_exists(5, $cpentry) ) {
    captiveportal_disconnect_client($cpentry[5], 1, "USER LOGOUT");

    Note : the $cpzone should be set to the actual captive portal zone instance name !

Log in to reply