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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T17:33:43+00:00 2026-05-20T17:33:43+00:00

I am writing a PHP website. I have a $_SESSION[‘id’] that hold the username

  • 0

I am writing a PHP website. I have a $_SESSION['id'] that hold the username id of a user, which I will use this value later on in my scripting. However, I notice that the ID changes as I surf the site.

Is id reserved in any way? Or, should I change id to something else?

This problem is happening whenever I click on a button several times. I am 100% sure that I’m not altering $_SESSION['id'] beyond the initial login.

Could someone please help me understand what is happening, and how it can be fixed.

  • 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-20T17:33:44+00:00Added an answer on May 20, 2026 at 5:33 pm

    I am going to assume you already use session_start, if not see the other comments 😛

    If you have register globals on, you may be seeing behavior like that if you use the variable $id in your code. As a test, try:

    <?php
    session_start();
    $_SESSION['testing'] = 'Foo';
    $testing = 'bar';
    die($_SESSION['testing']);
    ?>
    

    Reload the page a couple times. If bar prints out rather than Foo, that may be your problem. You’ll probably want to make the session variable name something that is less likely to get used elsewhere, or (more correct) turn off register globals.

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

Sidebar

Related Questions

I am thinking of writing a PHP extension library that will use the memcached
I'm writing an API for a website which doesn't have it. Basically, my PHP
I am writing a new website that uses PHP and MySQL. I am trying
Often when writing PHP I'll have it output some HTML like this - echo
I'm re-writing a website that will support multiple skins. Currently, I'm just planning on
I am writing a website with PHP. Since it will need to be accessed
I'm writing multilingual website. I have several files on server like: /index.php /files.php /funny.php
I have a website that written with php and using mysql, I want to
I'm writing a php script which will enable people to change the theme of
I have a PHP based website that uses coupon codes. I can restrict search

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.