The same session variable for different systems

I have a huge problem with the system I'm assigned to support.

In fact, these are many intranet systems.

The problem is that the original programmer created many systems for the intranet, which all connect to the database through a script, where username, pass, db params, etc. stored in $ _SESSION variables.

The problem occurs when a user logs into one system on a tab and then opens another tab for another system, and since the session variable is overwritten, he cannot continue to work in the first.

Keep in mind that there are dozens of applications ... do you think I can solve this problem without changing every existing application?

Thanks!

+3
source share
4 answers

You need to find ways to manipulate sessions.

One way - to use subdomains, such as app1.myoffice.local, app2.myoffice.localetc. Browsers do not use cookies cookies across domains.

Another trick is changing the session cookie path from /to subfolder. A cookie session myoffice.local/app1/should be limited /app1/, for myoffice.local/app2/should be limited /app2/, etc.

I think you can change this parameter in php through functions session_set_cookie_params( )or ini_set( )before calling session_start( ).

+2
source

Your best bet would be to try to establish session namespaces. So basically, the session data will look something like this ...

array("app1" => array(),  "app2" => array(), "app3" => array())

, , " "

+1

, cookie - .

0

:

http://www.decodephp.com/2006/11/16/php-sessions-across-subdomains-the-multiple-servers-issue/

:

.

, mod-rewrite php image . , , . http://something.com/something/spacer.jpg mod-rewite script? Set_cookies.php perv_id = 1234 & = & right_scroll = & mascot_header = , cookie abc.domain.com xyz.domain.com.

set_cookies.php cookeis, 1 × 1 . , 9 cookie, 9 . , , GET

0
source

Source: https://habr.com/ru/post/1723780/


All Articles