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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T02:34:33+00:00 2026-05-25T02:34:33+00:00

I am trying to add more security to my user authentication sessions. When the

  • 0

I am trying to add more security to my user authentication sessions. When the user login I regenerate_session_id but I would like your answer on if I regenerate_session_id on every page that I authenticate the user will help me out.

authenticate user on each page

<?php
    session_start();

    if(!isset($_SESSION['MEMBER_ID']) || (trim($_SESSION['MEMBER_ID']) == '')) {
        header("location: denied.php");
        exit();
    }
?>

I changed this to

session_start();

if(!isset($_SESSION['SESS_MEMBER_ID']) || (trim($_SESSION['SESS_MEMBER_ID']) == '')) {
    header("location: access-denied.php");
    exit();
} else {

session_regenerate_id(); }
  • 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-25T02:34:34+00:00Added an answer on May 25, 2026 at 2:34 am

    You may use session_regenerate_id to prevent session fixation attacks, in which the attacker learns the session ID of a given user then “hijacks” that session ID to act in place of the user.

    However, care must be taken. For one, you have to consider asynchronous requests. If you have many concurrent requests coming from a user, you’ll want to avoid a situation where one script is using session data when another tries to regenerate – one script is using data that the other is trying to destroy.

    Also, this does add overhead. Regenerating every request is probably an overkill. Instead, try keeping a request counter; every 10 requests (or so, arbitrary selection), regenerate the ID.

    Be sure to pass the argument as true – you don’t want or need the old session data sitting around (keeping in mind, still, concurrent requests). See the (docs) for more information.

    All that said – this mechanism is a sort of “micro-enhancement” that will give you more false sense of security than actual security. Session-fixation attacks are not very common, especially if you’re already taking other measures to bolster security. Nothing can replace, for example, using HTTPS for secure connection; nothing can replace password complexity requirements.

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

Sidebar

Related Questions

I am trying to add more specific error handling to my c# app, but
I'm trying to use fixtures to add more complex test data in order to
I'm trying add a tab to my web page that looks like this: Using
Im trying to add a directory foo to my repo, but there are some
I'm trying to add more fields to the CreateUserWizardStep , here is what I
I'm trying to add a small level of security to a site and encode
Trying to use security features and create Forms Authentication in my MVC3 application I
I am trying to add uipickerview in uiscrollview, but it is not being shown
I am trying to add some more conditional logic to my edit action by
I am trying to add datagridview control in my custom control but i failed.

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.