sessions[$data['phpsessionid']] = 1; $info = \db_get_row_filter( 'tsessions_php', ['id_session' => io_safe_input($data['phpsessionid'])] ); if ($info !== false) { // Process. $session_data = session_decode($info['data']); $this->idUser = $_SESSION['id_usuario']; // Valid session. return $this; } return null; } if (isset($data['id_usuario']) === true && isset($data['password']) === true ) { $user_in_db = process_user_login($user, $password, true); if ($user_in_db !== false) { $config['id_usuario'] = $user_in_db; $correctLogin = true; // Originally at api.php. if (session_status() === PHP_SESSION_NONE) { session_start(); } $_SESSION['id_usuario'] = $user; session_write_close(); $this->idUser = $data['id_usuario']; // Valid session. return $this; } } } return null; } }