Buenas tardes estimad@s, su gentil ayuda.
Mantengo un codigo el cual me permite ingresar sin problemas al sistema y me mantiene activa la sesión por un tiempo, el problema es cuando dejamos de estar frente al computador o dispositivo móvil y se cierra la sesión y perdemos el trabajo realizado, entonces necesito poder mantener activa la sesión por un lapso de 12 horas como minimo, este es el codigo que mantengo para session.php
<?php
session_start();
class Session {
public $msg;
private $user_is_logged_in = false;
function __construct(){
$this->flash_msg();
$this->userLoginSetup();
}
public function isUserLoggedIn(){
return $this->user_is_logged_in;
}
public function login($user_id){
$_SESSION['user_id'] = $user_id;
}
private function userLoginSetup()
{
if(isset($_SESSION['user_id']))
{
$this->user_is_logged_in = true;
} else {
$this->user_is_logged_in = false;
}
}
public function logout(){
unset($_SESSION['user_id']);
}
public function msg($type ='', $msg =''){
if(!empty($msg)){
if(strlen(trim($type)) == 1){
$type = str_replace( array('d', 'i', 'w','s'), array('danger', 'info', 'warning','success'), $type );
}
$_SESSION['msg'][$type] = $msg;
} else {
return $this->msg;
}
}
private function flash_msg(){
if(isset($_SESSION['msg'])) {
$this->msg = $_SESSION['msg'];
unset($_SESSION['msg']);
} else {
$this->msg;
}
}
}
$session = new Session();
$msg = $session->msg();
?>
Y en el .htaccess
# php -- BEGIN cPanel-generated handler, do not edit
# Set the “ea-php74” package as the default “PHP” programming language.
<IfModule mime_module>
AddHandler application/x-httpd-ea-php74 .php .php7 .phtml
</IfModule>
# php -- END cPanel-generated handler, do not edit
# BEGIN cPanel-generated php ini directives, do not edit
# Manual editing of this file may result in unexpected behavior.
# To make changes to this file, use the cPanel MultiPHP INI Editor (Home >> Software >> MultiPHP INI Editor)
# For more information, read our documentation (https://go.cpanel.net/EA4ModifyINI)
<IfModule php7_module>
php_flag display_errors On
php_value max_execution_time 30
php_value max_input_time 60
php_value max_input_vars 1000
php_value memory_limit 32M
php_value post_max_size 8M
php_value session.cookie_lifetime 14400
php_value session.gc_maxlifetime 14400
php_value session.save_path "/var/cpanel/php/sessions/ea-php74"
php_value upload_max_filesize 2M
php_flag zlib.output_compression Off
</IfModule>
<IfModule lsapi_module>
php_flag display_errors On
php_value max_execution_time 30
php_value max_input_time 60
php_value max_input_vars 1000
php_value memory_limit 32M
php_value post_max_size 8M
php_value session.cookie_lifetime 14400
php_value session.gc_maxlifetime 14400
php_value session.save_path "/var/cpanel/php/sessions/ea-php74"
php_value upload_max_filesize 2M
php_flag zlib.output_compression Off
</IfModule>
# END cPanel-generated php ini directives, do not edit