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

  • Home
  • SEARCH
  • 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 4567672
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T18:57:53+00:00 2026-05-21T18:57:53+00:00

I use PHP sessions with session_start() to maintain state of which user is logged

  • 0

I use PHP sessions with session_start() to maintain state of which user is logged into my site. This works fine by just calling session_start() and the top of all my files once the user is logged in.

However, I’d like to have it so when they click the site’s icon in the menu bar, if they are logged in it won’t send them to the homepage but rather to their logged in personal page. However, a simple session_start() to recognize the user is logged in and redirect them at the top of the homepage does not work.

None of the session variables are recognized from the home page. Yet the session is not actually killed – I can go back in the history and am still logged into the site. Would there be a reason the homepage should give different behavior than every other page?

  • 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-21T18:57:54+00:00Added an answer on May 21, 2026 at 6:57 pm

    No, it shouldn’t be different.
    In order to see what variables are available in your $_SESSION, you can do this

    var_dump($_SESSION);
    

    If it’s empty then there is a problem. You can try to see the session_id with the method

    echo session_id();
    

    It should be the same session_id in both your logged page and home page. If this is not the case, maybe you are messing up with cookies?

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

Sidebar

Related Questions

How can I use a database and PHP sessions to store a user's shopping
PHP sessions work by default with my configuration, if I just go session_start() and
How secure are php Sessions? I am planning to use the native PHP sessions
I'm using iPage.com host. In order to use PHP sessions in their host I
I'm using Zend Framework for PHP and handling sessions with the Zend_Session module. This
On our development server, sessions handling works fine. On our production server, it doesnt.
I use the following PHP script as index for my website. This script should
I use http://github.com/abraham/twitteroauth PHP library for reaching Twitter REST API: <?php session_start(); require(config.php); require(twitteroauth/twitteroauth.php);
Is it possible to use PHP's SimpleXML functions to create an XML object from
At the moment I use PHP for almost everything I develop for the Web

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.