Welcome Guest, Not a member yet? Register   Sign In
session expires automatically, ¿Why?
#1

[eluser]josepichu[/eluser]
Hi!

I have implemented a simple authentication system. It concists, In a common login page and a hook to check the session. In the case of not being logged, it redirect to de login page.

The problem is that, the session expires automatically :S. here the code:

hooks.php
Code:
$hook['post_controller_constructor'] = array(
                                'class'    => 'Control_auth',
                                'function' => 'index',
                                'filename' => 'control_auth.php',
                                'filepath' => 'hooks'
                                );

control_auth.php
Code:
<?php

class Control_auth {

function index() {

  $CI =& get_instance();
  //$CI->load->library('uri');
  
  $url = site_url() . "login";
  
  if ($CI->uri->segment(1) == '' || $CI->uri->segment(1) != 'login') {
  
   if ($CI->session->userdata('logged_in') == false) echo "[removed][removed]='$url'[removed]";


  
  }
  

}

}

config.php
Code:
$config['enable_hooks'] = TRUE;

$config['sess_cookie_name']  = 'ci_session';
$config['sess_expiration']  = 7200;
$config['sess_expire_on_close'] = TRUE;
$config['sess_encrypt_cookie'] = TRUE;
$config['sess_use_database'] = TRUE;
$config['sess_table_name']  = 'sesiones_usuarios';
$config['sess_match_ip']  = FALSE;
$config['sess_match_useragent'] = TRUE;
$config['sess_time_to_update'] = 300;
#2

[eluser]josepichu[/eluser]
I realized my error is the

Code:
$config['sess_time_to_update'] = 10;

for example if i put 10seconds, after 10 seconds the application log out and redirect to the login page... ¿Why?

Thanks.




Theme © iAndrew 2016 - Forum software by © MyBB