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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T17:34:41+00:00 2026-05-17T17:34:41+00:00

I am at a total loss for words. I allow an admin to reset

  • 0

I am at a total loss for words.

I allow an admin to reset their registration if reaching an error during the process. In theory, the following code should function like this:

page is reached, $adminvalidated is set based on session data. The $_SESSION array is cleared; the cookie is cleared on the consumer end; the session id is regnerated and the session is destroyed. Then the session is restarted and the previously mentioned variable is put back into Session.

the “echo” statements included below work but when I redirect to another page (commented out below), the session variables DO NOT carry over.

Yes I have started the session on the follow up page as well.

<?php
    session_start();
    ob_start();
    if( $_SERVER['SERVER_PORT'] == 80) {
        header('Location:https://'.$_SERVER['HTTP_HOST'].$_SERVER["REQUEST_URI"]); 
        die();
    } 

    $adminvalidated = $_SESSION['ADMINVALIDATED'];

    $_SESSION = array();

    if (ini_get("session.use_cookies")) {
        $params = session_get_cookie_params();
        setcookie(session_name(), '', time() - 42000,
            $params["path"], $params["domain"],
            $params["secure"], $params["httponly"]
        );
    }

    session_regenerate_id(true);
    session_destroy();
    session_start();

    $_SESSION['ADMINVALIDATED'] = $adminvalidated;

    echo $_SESSION['ADMINVALIDATED'];

/*
    header("Location: ../a.php");
    exit;*/
?>
  • 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-17T17:34:41+00:00Added an answer on May 17, 2026 at 5:34 pm

    In general it suffices to call session_regenerate_id(true) to change the session ID of the current session and invalidate the association with the previous session ID.

    If you additionally want to clear any session data except $_SESSION['ADMINVALIDATED'], just do this:

    session_regenerate_id(true);
    $_SESSION = array(
        'ADMINVALIDATED' => $_SESSION['ADMINVALIDATED']
    );
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm a total loss. I have this function to read the Twitter Json. The
I have the following example code: create table Details( name varchar(20), age int, weight
I'm at a total loss on why I can't align the Search box to
Good afternoon, I am at a total loss on why this is happening. I
Consider the following code: public class InboxMenuItemDynamicProvider : DynamicNodeProviderBase { private IMyService _myService {
I've never had this problem before, I'm at a total loss. I have a
I have the following line of code: @ranking_array = User.joins(:bets, :choices).select(users.id, sum(bets.profitloss + choices.profitloss)
i have following code for heapsort #include <iostream> using namespace std; void exch(int a[],int
I am using Mongoid, Rails and Fabrications and at a total loss with how
I'm really an absolute newbie at Haskell, so I'm at a total loss as

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.