Logout Personalizado Pfsense 2.4.3



  • <html lang="en">
    <head>
    <title>.:: Desconectar Wifi Nombre Empresa ::.</title>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link href="css/style1.css" rel='stylesheet' type='text/css' />
    <script src="js/jquery-1.10.1.min.js" type="text/javascript"></script>
    <script src="bootstrap-3.3.7/js/bootstrap.min.js" type="text/javascript"></script>
    <link rel="stylesheet" href="bootstrap-3.3.7/css/bootstrap.min.css"/>
    <script src="js/jquery.validate.min.js" type="text/javascript"></script>
    <script src="js/jquery.backstretch.min.js" type="text/javascript"></script>
    <script type="text/javascript" src="css/select2.min.js"></script>
    <script src="css/login-soft.js" type="text/javascript"></script>
    <link rel="stylesheet" href="font-awesome/css/font-awesome.min.css"/>
    <script src="sweetalert/sweetalert.min.js" type="text/javascript"></script>
    <link rel="stylesheet" href="sweetalert/sweetalert.css"/>
    </head>
    <?php
    if(!isset($_REQUEST['full_url'])){
    $protocol = isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off' ? 'https' : 'http';
    $full_url = $protocol."://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
    }
    $cpuser = captiveportal_isip_logged($clientip);
    if(isset($_REQUEST['logout_id'])){
    captiveportal_disconnect_client($cpuser[5], 1, "LOGOUT");
    echo '<body style="background-color:#ffff"; color:white;>';
    echo $redirurl;
    ?>
    <style>
    .panel-custom{
    background-color: #9a0614;
    border-color: # #9a0614;
    color: #FFFFFF;
    }
    .panel-default > .panel-heading {
    background-color: #9a0614;
    border-color: # #9a0614;
    color: #FFFFFF;
    }

    </style>
    <div class="container" style="margin-top:10%">
    <div class="row">
    <div class="col-sm-6 col-md-4 col-md-offset-4">
    <div class="panel panel-default">
    <div class="panel-heading">
    <strong><i class="fa fa-wifi" aria-hidden="true"></i> Usuario Desconectado</strong>
    </div>
    <div class="panel-body">
    <p>Si requiere volver a conectarse, favor de cerrar su navegador
    para no tener problemas de conexión.</p>
    <p>Gracias !!!</p>
    <p>Atte. Administración</p>
    </div>
    <div class="panel-footer panel-custom">Wifi Nombre Empresa</div>
    </div>
    </div>
    </div>
    </div>
    <script>

    </script>
    <?php
    echo '</body>';

    }else{
    ?>
    <body style="background-color:#435370">
    <div class="container" style="margin-top:40px">
    <div class="row">
    <div class="col-sm-6 col-md-4 col-md-offset-4">
    <div class="panel panel-warning">
    <div class="panel-heading">
    <strong><i class="fa fa-wifi" aria-hidden="true"></i> Bienvenido</strong>
    </div>
    <div class="panel-body">
    <form role="form">
    <fieldset>
    <div class="form-group">
    <input name="logout_id" type="submit" class="btn btn-lg btn-primary btn-block" value="Desconectar">
    </div>
    <div class="form-group">
    <a href="<?php echo $redirurl;?>" target="_blank" class="btn btn-lg btn-primary btn-block">Continuar</a>
    </div>
    <input name="logout_id" type="hidden" value="<?php echo $sessionid; ?>" />
    <input name="zone" type="hidden" value="<?=$cpzone;?>" />
    <input id="full_url" name="full_url" type="hidden" value="<?php echo $full_url;?>"/>
    </fieldset>
    </form>
    </div>
    </div>
    </div>
    </div>
    </div>
    </body>
    </html>
    <?php
    }
    ?>



  • @gerardonoh said in Logout Personalizado Pfsense 2.4.4 develop:

    Envia Failed setsockoptFailed setsockopt

    Have pfSense tell you what the variables are that you are using ;)

    <?php
    require_once("captiveportal.inc");
    captiveportal_logportalauth("cpuser5 = [" . cpuser[5] . "] cpuser  = [". $cpuser . "] sessionid  = ]" . $sessionid . "] Client IP = [" . $clientip ."]")
    .....
    

    Now you can checkout the captive portal log - and see what values are used, and check if these are correct.

    Btw : compare your html code with the default logout code : https://github.com/pfsense/pfsense/blob/3a00b1b2b5b32aabca51b79875f27d682887364e/src/etc/inc/captiveportal.inc#L326 -