See username after login on landing page, restrict access to the page and logout
Hello, thanks for reading.
I have the following WA code on the destination page after login:
<?php
error_reporting(E_ALL);
ini_set('display_errors', '1');
?>
<?php require_once('../Connections/Prueba_MCC_i.php'); ?>
<?php require_once('../webassist/mysqli/rsobj.php'); ?>
<?php require_once('../webassist/mysqli/authentication.php'); ?>
<?php require_once('../webassist/mysqli/queryobj.php'); ?>
<?php
if ($_SERVER["REQUEST_METHOD"] == "POST") {
$RestrictAccess = new WA_MySQLi_Auth();
$RestrictAccess->Action = "restrict";
$RestrictAccess->Name = "user";
$RestricAccessRedirect = "MCC_error.php";
if (function_exists("rel2abs")) $RestricAccessRedirect = $RestricAccessRedirect?rel2abs($RestricAccessRedirect,dirname(__FILE__)):"";
$RestrictAccess->FailRedirect = $RestricAccessRedirect;
$RestrictAccess->execute();
}
?>
<?php
if ($_SERVER["REQUEST_METHOD"] == "POST") {
$LogOut = new WA_MySQLi_Auth();
$LogOut->Action = "logout";
$LogOut->Name = "user";
$LogOut->execute();
}
?>
In my Connections panel, the Session that has two elements appears. One of them is the name of the user (which I call "u_nombre_completo") I have dragged to the place of my document where I want it to be seen. This is the resulting code:
<div class="Llamada">
Estás autenticada/o como: <?php echo $_SESSION['u_nombre_completo']; ?><span class="Separador"> </span> | <a href="#" class="Enlace_1">Cerrar sesión</a> </div>
However, three things happen:
1. The page is not really restricted to access even though I included the WA behavior restricting access.
2. The username placed the way I did it, gives the following php error
Notice: Undefined index: u_nombre_completo in /Applications/MAMP/htdocs/MCC_01_edicion_DW/__admin/edicion.php on line 150
| Cerrar sesión
which corresponds precisely to the variable:
<?php echo $_SESSION['u_nombre_completo']; ?>
3. I can not find in MySQLi Server Behaviors the way to put the corresponding link in the button logout ("Cerrar Session")
I think I've looked at the tutorials, but I can not find the solutions to my problems.
Can anybody help me please. Thank you very much