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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T08:22:07+00:00 2026-06-13T08:22:07+00:00

I am writing a script which is supposed to end a session for a

  • 0

I am writing a script which is supposed to end a session for a user, and log them out of the system, thus returning them to the login page.

My logout script looks like this:

<?php

$_SESSION['signin'] = null;

session_destroy();

header("Location: /test/index.php");

?>

Initially I reset the signin variable that way even if the session isn’t destroyed the variable should have at least changed so that the system believes the user is logged out.

And at the top of my login page I have a condition to forward them to the home page if they are already logged in, that way that can’t visit the log in page once already logged in. This portion looks like this:

<?php
session_start();
if($_SESSION['signin'] == 5)
{
        header("Location: /test/home.php");
}
?>

So in short, when someone is logged in, and clicks the link to logout it utilizes the first code block to log out, and then is forwarded to the page containing the second blcok of code.

However, this page still forwards me back to the home page, believing the user is still signed in and thus I’m guessing the signin variable was not reset.

Thoughts on how to solve my issue?

  • 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-13T08:22:08+00:00Added an answer on June 13, 2026 at 8:22 am

    session_destroy() does not unset any of the global variables within the session. Simply using:

    session_unset();
    

    to unset all global variables, or to only unset the specified variable, use:

    unset($_SESSION['signin']);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am writing installation script for my program, which is supposed to run on
Im writing a script in powershell which is supposed to connect to a MySQL
I'm writing a script which requires some stuff to be carried out in an
I've been writing a simple PHP script which is supposed to generate a RSS
I'm writing a script which manages a very large table. When a user clicks
I'm writing a script which pulls out some patient data and generates an XML
I am writing a script which will do this: #!/bin/bash mysqldump -u user -p
I am currently writing a script which parses the ServiceTage, Computername and Username from
I am writing a script which counts all files and folders recursively. I tried
I'm writing a script which is to be executed hourly. It basically works 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.