Skip to content
This repository has been archived by the owner on Sep 28, 2018. It is now read-only.

Accessing already opened session #4

Open
arturcesarmelo opened this issue Apr 25, 2018 · 0 comments
Open

Accessing already opened session #4

arturcesarmelo opened this issue Apr 25, 2018 · 0 comments

Comments

@arturcesarmelo
Copy link

arturcesarmelo commented Apr 25, 2018

My legacy project has differents index.php. Depends on url, .htaccess redirects to another index.php in another folder, when i include autoloads and starts all again like is shown bellow.

paht: app.project.com/
index: ./index.php

include 'autoloads.php';

$session = new \Gears\Session();

$session->dbConfig = [
  'driver'    => dotenv('DB_CONNECTION'),
  'host'      => dotenv('DB_HOST'),
  'database'  => dotenv('DB_DATABASE'),
  'username'  => dotenv('DB_USERNAME'),
  'password'  => dotenv('DB_PASSWORD'),
  'charset'   => 'utf8',
  'collation' => 'utf8_unicode_ci',
  'prefix'    => '',
];

$session->globalise();

when i do login, the project will redirectme to

paht: app.project.com/login
index: ./admin/main.php

include 'autoloads.php';

$session = new \Gears\Session();

$session->dbConfig = [
  'driver'    => dotenv('DB_CONNECTION'),
  'host'      => dotenv('DB_HOST'),
  'database'  => dotenv('DB_DATABASE'),
  'username'  => dotenv('DB_USERNAME'),
  'password'  => dotenv('DB_PASSWORD'),
  'charset'   => 'utf8',
  'collation' => 'utf8_unicode_ci',
  'prefix'    => '',
];

$session->globalise();

The problem is that ever when it's called new \Gears\Session(), the session which i started in index.php is erased on main.php. If i do not call new \Gears\Session(), when i try to access Session::anything, an exception is thrown on screen saying: You need gobalize first. Is there any way to solve that?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant