Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 253763
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T21:47:25+00:00 2026-05-11T21:47:25+00:00

Recently I stumbled on an interesting bug where entries would show up in our

  • 0

Recently I stumbled on an interesting bug where entries would show up in our local custom-made ticket system from users that didn’t exist in the app. After some poking around I realised that both this and another PHP app running on the same server were using $_SESSION[‘user’] for authentication purposes. When someone used one system and then opened the other one he was “automatically” logged in as a user from the first app.

After the obligatory facepalm I changed the session variable name in one of the systems to stop this. However I need to make a permanent, zero-maintenance change to my session handling class to avoid this in future projects. I figure this could be done by using a unique value (for example the script path) to put an app’s variables in a place in $_SESSION that wont be used by another app.

Is there a better way?

Edit: This is on linux. And both apps are on the same website.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-11T21:47:25+00:00Added an answer on May 11, 2026 at 9:47 pm

    You can ensure that the Session cookies will be specific to the application by making sure that the domain and path of the cookies are set restrictively, e.g. for an application at http://www.example.com/apppath, you could do the following:

    <?php
    
    $currentParams = session_get_cookie_params();
    
    session_set_cookie_params($currentParams['lifetime'], '/apppath/', 'www.example.com', $currentParams['secure'], $currentParams['httponly']);
    
    session_start();
    

    This will leave the other session settings intact.

    The path is probably the important one, by default PHP will issue the cookie for the domain that the site was requested over (I think), so you could probably actually leave the domain parameter as the default.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have recently stumbled upon a problem with selecting relationship details from a 1
I recently stumbled upon this interesting concept that may save me much testing efforts.
I have recently stumbled uppon this website GrandPixels and found one interesting effect. In
Recently stumbled upon this neat little bug or 'feature' in PHP: function myCmpFunc($a,$b) {
I recently stumbled upon this Wikipedia article . From my experience with multi-threading I
I have recently stumbled upon an open source project that I would like to
Recently I stumbled upon a problem that involves moving asp classic sites from a
I want to share this odd but interesting situation I stumbled upon recently while
Recently stumbled upon a stock video footage site http://www.pond5.com/stock-video-footage/1/*.html , and saw that they
I recently stumbled upon Play framework while evaluating frameworks to use in a project.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.