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 7045435
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T02:31:49+00:00 2026-05-28T02:31:49+00:00

I am facing a strange scenario. basically on my every web page i am

  • 0

I am facing a strange scenario. basically on my every web page i am doing

session_start();
if(!isset($_SESSION['login']))
    header("Location: login.php");

to ensure every user has logged in first. I am working in chrome and what happens is if I login to my web application and open any page it works fine. At the same time if, in another tab, I login to my hosting server, I am logged out of my web application. If I login to my application again, I am logged out of my hosting server!!

What am I doing wrong? is there a problem the way I am checking or setting the session variable?

I am setting the session as follows:

//if authentication successful
session_start();
    $_SESSION['login'] = "1";
  • 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-28T02:31:49+00:00Added an answer on May 28, 2026 at 2:31 am

    I have a very similar problem, and I think this happens just because two sessions with the same name, in the same place of the same domain can’t coexist.

    Maybe a solution should be to use session cookies. You can set a cookie just for a folder and not for the whole domain. This way I think you can manage 2 sessions at the same time, but I’m not sure.

    Try this:

    session_start();
    setcookie(session_name(), session_id(), 0, '/public/');
    

    Where /public/ might be the specific folder where your site is located, or the application path (thanks Paul for pointing out this).

    Then you will check if session is set:

    $session_cookie = 
       isset($_COOKIE[ini_get('session.name')]) ? 
       $_COOKIE[ini_get('session.name')] : 
       null;
    

    Probably this won’t work, since the other session might be “stored” in the root folder of your web application. But if you are able to do the thing above also for your hosting server, you should resolve your problem.

    You can also try to set a different name for the session in your web application.

    Hope this helps.

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

Sidebar

Related Questions

I am facing a strange problem. My PHP page has following code. echo <div
I am facing strange issue on Windows CE: Running 3 EXEs 1)First exe doing
I am facing an strange issue. I developed java web app in java 6
I am facing a strange issue with my project ... when page is rendering
I am facing a strange behaviour for an .aspx page. I have DataList called
I am facing a strange scenario only in IE7 like, adding a class to
I am facing a strange problem with calling two web services in the same
I'm facing a strange issue, I'm trying to localize a website, so i converted
I am facing a strange problem on my Ubuntu Karmic system. When I call
I am facing a strange problem with my iphone. It shows available memory as

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.