Welcome Guest, Not a member yet? Register   Sign In
Crossing sessions data
#1

I am currently having a problem with the sessions at the time of logging in with a user, when the user starts the session, the session takes the data of another user who is connected to the system on another computer and also shows sales data that the other user is performing, sometimes refreshing the site returns to normal.

HomeController.php


Code:
public function login()
{
    $username = $this->input->post('username');
    $password = $this->input->post('password');

    $usuario = $this->Modelousuarios->verificar_usuario($username, md5($password));

    if($usuario){
        $permisos = $this->Modelousuarios->permisos($usuario->codigousuario);
        $this->login_success($usuario, $permisos);
    }
    else{
        $this->login_fail();
    }
}

private function login_success($usuario, $permisos)
{
    $session_data = array(
        'autenticado' => TRUE,
        'nombre_usuario' => $usuario->nombreusuario,
        'nombre' => $usuario->nombre,
        'codigo' => $usuario->codigousuario,
        'tipo_usuario' => $usuario->tipousuario,
        'codigolocal' => $usuario->codigolocal,
        'permisos' => $permisos
    );

    //Quitando los datos de la session si existen
    $this->session->unset_userdata($session_data);

    $this->session->set_userdata($session_data);

    redirect('facturacion/realizar-venta');
}

Modelousuarios.php


Code:
function verificar_usuario($user, $pass) {
    $query = $this->db->query("select * from usuarios where nombreusuario='{$user}' and contrasena='{$pass}' and estado = 1 ");

    if ($query->num_rows() > 0) {
        return $query->row();
    } else {
        return false;
    }
}

This is my current session configuration in config.php


Code:
$config['sess_driver'] = 'database';
$config['sess_cookie_name'] = 'ci_session';
$config['sess_expiration'] = 0;
$config['sess_save_path'] = 'ci_sessions';
$config['sess_match_ip'] = FALSE;
$config['sess_time_to_update'] = 0;
$config['sess_regenerate_destroy'] = FALSE;

I hope you can help me, this problem is driving me crazy... Sorry for my english, regards.
Reply


Messages In This Thread
Crossing sessions data - by Luis Romero - 02-21-2020, 08:46 AM
RE: Crossing sessions data - by jreklund - 02-21-2020, 01:04 PM
RE: Crossing sessions data - by Luis Romero - 02-21-2020, 02:13 PM
RE: Crossing sessions data - by jreklund - 02-21-2020, 02:57 PM
RE: Crossing sessions data - by Luis Romero - 02-21-2020, 07:27 PM
RE: Crossing sessions data - by jreklund - 02-22-2020, 02:53 AM
RE: Crossing sessions data - by Luis Romero - 02-22-2020, 09:36 AM



Theme © iAndrew 2016 - Forum software by © MyBB