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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T16:54:20+00:00 2026-05-23T16:54:20+00:00

A friend of mine starts his Session this way. <?php session_start(); session_regenerate_id(); session_destroy(); unset($_SESSION);

  • 0

A friend of mine starts his Session this way.

<?php
session_start();
session_regenerate_id();
session_destroy();
unset($_SESSION);
session_start();
?>

Are there any security advantages, against Session hijacking etc.

Just wondering why as against the usual session_start();

  • 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-23T16:54:20+00:00Added an answer on May 23, 2026 at 4:54 pm

    All you’d need is

    session_start()
    session_regenerate_id()
    

    That’ll start the session and change its ID on each request. However, this will not prevent session hijacking. If the attacker can get the user’s session cookie and sent a request back to the server BEFORE the user can, then the attacker gets a brand new session ID, and the user is left with an invalid session token and is effectively logged out.

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

Sidebar

Related Questions

A friend of mine sent me this code snippet to celebrate his new baby
I friend of mine asked me if there is a way to detect a
A friend of mine told me there was a way to connect two private
A friend of mine came to me with this strange behavior which i can't
A friend of mine needs to use MATLAB for one of his classes, so
A friend of mine brought up this questiont he other day, he's recently bought
Friend of mine has a problem :). There is an application written in Visual
A friend of mine is getting this error on ALL of her websites. They
A friend of mine really likes using Joomla as a base for his websites.
a friend of mine gave me a piece of his software and I'm trying

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.