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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T02:01:43+00:00 2026-06-17T02:01:43+00:00

When having user login to the site I need to somehow store the logged

  • 0

When having user login to the site I need to somehow store the logged in user id so that my site can generate different content for different users.

Is it secure to save a user’s id in a $_SESSION[] variable?

Is it possible for a user to change the $_SESSION[] data and pretend to be another user?

I use the id to check which data I should fetch from the database and to see which permissions the user has.

  • 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-06-17T02:01:44+00:00Added an answer on June 17, 2026 at 2:01 am

    Best and accepted practice is to save the user id in the session.

    The session is by default stored in /tmp as a file. It is not view able by the end user unless you have security issues such as directory traversal vulnerabilities. Most applications use $_SESSION as you are. If there where a wide spread weakness then major projects would be doing things differently. You don’t have to worry about server-side Session value being obtained through a client-side exploit. Also keep in mind the simplicity of using the session as well. It makes data access to user specific data that you need to access constantly, standard and consistent throughout your application.

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

Sidebar

Related Questions

I'm having users login to my site using Facebook. They are sent away from
Hai am having a WPF user control, when i use that control in another
We're having the following situation: a web site requires the user to log on
I am having an issue that I hope you can help with. Let's say
I have a Twitter widget on my site where I allow users to login
doing a simple login for my website, which will hopefully keep the user logged
I am having problems with user authentication for my django site. I have a
Let's pretend that I have a site where the users create topics and write
I'm having a problem with a user logging in: 1) click facebook login button
I'm struggling with having a login dialog box appear on login. What I need

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.