I uploaded my website to a hosting, in fact I had already tested it successfully. The problem is that the login is reloaded and does not enter the cover:
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>GESTION OTTRA</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<link rel="stylesheet" type="text/css" href="css/stylos.css"/>
<meta charset="utf-8" />
<link rel="stylesheet" href="bootstrap/css/bootstrap.min.css" />
<link rel="stylesheet" href="bootstrap/css/bootstrap.css" />
<link rel="stylesheet" href="bootstrap/css/bootstrap-theme.min.css" />
<link rel="stylesheet" href="bootstrap/css/bootstrap-theme.css" />
<link rel="stylesheet" href="bootstrap/css/bootstrap-theme.css" />
<link rel="stylesheet" href="css/stylos.css" />
<script src="includes/jquery-3.3.1.js"></script>
<script src="bootstrap/js/bootstrap.js"></script>
</head>
<body>
<?php session_start(); ?>
<script type="text/javascript" src="views/login.js"></script>
<?php
include_once ($_SERVER['DOCUMENT_ROOT'].'/routes.php');
if ( isset($_SESSION['username']) && isset($_SESSION['userid']) ){
include_once ($_SERVER['DOCUMENT_ROOT'].'/views/template.php');
if (isset($_GET['controller'])&&isset($_GET['action'])) {
$controller=$_GET['controller'];
$action=$_GET['action'];
if (isset($_GET['id'])){
$id=$_GET['id'];
call($controller,$action,$id);
}else{
call($controller,$action,0); }
}else{
echo "nn"; }
}
else{
echo '<div class="contenedor">
<div class="cabecera">
</div>
<div class="cuerpo">
<div class="panel panel-primary" style="width:50%">
<div class="panel-heading">INGRESE AL SISTEMA</div>
<div class="row">
<div class="col-sm-4">
<label style="color: blue">Usuario:</label></div><div class="col-sm-4">
<input type="text" style="color:blue" name="login_username" id="login_username" /></div>
</div><div class="row"><div class="col-sm-4">
<label style="color: blue">Contraseña:</label></div><div class="col-sm-4">
<input type="password" name="login_userpass" id="login_userpass" style="color:blue" />
</div>
</div>
<div class="row"><div class="col-sm-4">
<span class="timer" id="timer"></span><button id="login_userbttn" class="btn btn-primary">Login</button></div>
</div> </div>
</div>
';
}
?>
</body>
</html>
In the login process file doing a var_dump the session is created perfectly. It is more I have a method that registers the session in the database with date and time and other and the registers are seen every time I log in a new one appears.
But as you can see above, the session does not arrive, I've already done var_dump ($ _ SESSION) and it gives null. But what can it be?
<?php
session_start();
include_once ($_SERVER['DOCUMENT_ROOT'].'/models/claseLogin.php');
$U1=new Login();
$usuario=$_POST['login_username'];
$pass=$_POST['login_userpass'];
$arrayu=$U1->User($usuario,$pass);
if (count($arrayu)>0){
foreach ($arrayu as $n){
$_SESSION['username']=$n['nombre'];
$_SESSION['userid']=$n['iduser'];
$_SESSION['rol']=$n['rol'];
$id=$U1->registroSesion($_SESSION['userid']);
foreach ($id as $i){
$idmax=$i['max'];
$_SESSION['idsesion']=$idmax;}
}echo 1;
}
else{
echo 0;}
?>