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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T05:26:28+00:00 2026-06-09T05:26:28+00:00

I have a simple login setup, where I use a cookie to store a

  • 0

I have a simple login setup, where I use a cookie to store a login ID #, and with this ID, username and other information can be displayed.

So in order to logout, I run the following php script to log out:

<?php
if (isset($_COOKIE['id'])) {
setcookie("id","",1);
}
header("Location: redirectpage.html");
exit;
?>

Which basically expires the cookie. However, when I arrive at the redirect page, which has the following code:

If (isset($_COOKIE['id'])) {
//display "You are logged in already"
} else {
// show login form
}

It says I am still logged in, and moving to a different pages still says I am logged in, and displaying the cookie value gives me an actual value, meaning the cookie has not expired. I must be missing something here, but why has the cookie not expired?

Note: I changed the expiration date from time()-60 or some value to 1, but this did not change anything, and removing the if statement to just expire the cookie every time the php code runs still does not do the trick.

  • 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-09T05:26:31+00:00Added an answer on June 9, 2026 at 5:26 am

    Make sure that you are trying to delete the cookie using the same parameters you used to create it. From the php manual, http://gr2.php.net/setcookie, under “common pitfalls”:

    Cookies must be deleted with the same parameters as they were set
    with. If the value argument is an empty string, or FALSE, and all
    other arguments match a previous call to setcookie, then the cookie
    with the specified name will be deleted from the remote client. This
    is internally achieved by setting value to ‘deleted’ and expiration
    time to one year in past.

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

Sidebar

Related Questions

I have a simple app where you can login it looks like this: {{#view
I have a simple GAE app that includes a login/logout link. This app is
I have simple login box, which is centered to the middle of page (vertical
I have a simple login form and have jQuery validate replacing the field labels
Basically I have a simple login form. In the database I have a 'last_logged'
I have a simple html login form which is validated with javascript before its
Implementing a simple Login screen using JSF and Spring and Hibernate. I have written
Is there any example on how to implement a simple login page/dialog? I have
I have a simple file-system-ed-login (not mysql) just to track number of users who
let's say I have a simple javascript like so: $(document).ready(function(){ if(login == 1) {

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.