Código PHP:
?php
echo' <div id="login" >
<form id="form-login" method="post">
<div class="">
<div id="login-user">
<input id="login-username" type="text" class="text" name="username" placeholder="Email" tabindex="1" maxlength="20" required >
</div>
<div id="login-pass">
<input id="login-password" type="password" class="text" name="password" placeholder="Contrasenya" tabindex="2" maxlength="30" required >
</div>
<div id="btnlogin">
<p><input id="botonlogin" class="submit" type="submit" name="login" value="Iniciar sessió"></p>
</div>
<div id="remember">
<span id">
<a href="#" id="pswd_missing_link" > Recupera la Contrasenya </a> | <a href="registre.php" id="registre_link"> Registrar-se </a>
</span>
</div>
</div>
</form>
</div>';
?>
Código PHP:
<?php
if(!empty($_SESSION['s_username'])) {
$usuario= $_SESSION['s_username'];
?>
<div style="margin: 10px; background-color: rgba(255,255,255,0.7); border-radius: 3px; height: 70px; width: 150px; float: right; font-weight: "> <span style="margin-left:5px">Benvingut:</span> <?echo $usuario;?>
<div id="btnlogin">
<form method="POST">
<?php if($_SESSION['Rol']=='2'){
?>
<a href="admin.php" style=" margin-left: 5px"> Administrar</a> |
<?php
}?>
<a href="user_panel.php" style=" margin-left: 5px"> Zona Privada</a> |
<input type="submit" name="CerrarSesion" value="Sortir">
</form>
</div></div>
<?php
} else {
include_once($_SERVER['DOCUMENT_ROOT']."/web/formulari_login.php");
}
Código PHP:
<?php
include_once($_SERVER['DOCUMENT_ROOT']."/web/query/classUser.php");
include_once($_SERVER['DOCUMENT_ROOT']."/web/query/validation.php");
include_once($_SERVER['DOCUMENT_ROOT']."/web/query/sessions.php");
if (isset($_POST['login'])){
if(isset($_POST['email']) && isset($_POST['password'])){
$email= $_POST['email'];
$password = $_POST['password'];
$user = new User();
$user->login($email,$password);
if($_SESSION['Rol']=='1'){
}
}
}
?>
Alguien sabe que puede ocurrir?
MUCHAS GRACIAS!