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

Accessing already opened session #4

Description

@arturcesarmelo

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?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions