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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T15:55:47+00:00 2026-05-24T15:55:47+00:00

When the user is login success, I will have a user_id to access to

  • 0

When the user is login success, I will have a user_id to access to the session. But the question is can the user/hacker enable to modify, after I assigned? Because the user_id I will use to query and insert db and use this user_id to do all the query. If this is dangerous and not security, what else can I do? Thank you.

  • 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-24T15:55:49+00:00Added an answer on May 24, 2026 at 3:55 pm

    When you say that you will have a “user_id to access the session”, it sounds like you are really talking about a session ID, not a user ID. Basically this is a cookie that you set upon successful login, and the server uses the cookie to look up the right session.

    Beware: session hijacking. Using a session ID is a pretty standard scheme (though it’s usually called session ID, not user ID), but it really depends how it is implemented. In general you want the app server to handle this for you automatically, rather than having to code it up yourself, because there are more and less secure ways to do it. If the session IDs are guessable, for example, then your app is vulnerable to so-called session hijacking. Obviously you don’t want the IDs to be a sequence, but that’s not all. You want them to be random, you want them not to have patterns (not always easy to see–but there are tools to determine whether there are patterns), you want there to be sufficiently many bits at play when generating the session ID, etc. Usually this is stuff that app developers would delegate to the supporting infrastructure.

    Beware: session fixation. One other risk is session fixation. There are different varieties, but the basic concept is that the attacker tricks somebody into clicking on a link with a known session ID (which can be done when the session ID is passed along in the URL instead of using a cookie). He may for example post the link in a public forum, then the victim clicks on it and subsequently authenticates the session. Now the attacker can take over the session and he’s authenticated to boot. One countermeasure is to make sure that the app generates a new session ID when it receives an unrecognized session ID from the client, as opposed to simply accepting the unrecognized session ID and starting a new session with it. If you are using a standard mechanism for generating session IDs then there’s a good chance (though no guarantee–look at your documentation) that it already provides this countermeasure, as least as a configuration option. If you write your own then it’s something that a nonexpert would almost certainly overlook.

    Identifying session and user IDs leads to session hijacking. One other thing. If you are using a single ID to do double-duty as a session ID and a user ID–don’t do that. First, sessions and users are conceptually different things (a session has an associated user, but it isn’t the same thing as the user), so from a pure modeling perspective, it’s not correct. But more importantly, user IDs usually aren’t a secret, and they show up in things like URLs (which users can see). Session IDs on the other hand are definitely secret. So if for example every time I log into your app you send me a cookie that says “user_id=14” then all somebody has to do is go look at your app, notice that I’m user 14, and then periodically try to pass a “user_id=14” cookie to your app. Sooner or later they’ll do that at the same time that I’m actually logged in, and voila, session hijack.

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

Sidebar

Related Questions

I have a web-based system built with user login data based on session variables.
I'd like to switch databases upon user login. I've created this login signal.. but
I'm trying to get the current user login status via javascript sdk but I
I have an and users can login and view their own profile with a
I have been trying to make a user login page that, when the user
I have a common login and logout screen. When i logout after signing in...
I'm trying to create a simple login system that will have the forms and
I have a server side function that requires login. If the user is logged
Hopefully this will be a straightforward solution but I can't seem to solve it
I have confused for this login method, especially for different access page for some

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.