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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T22:01:30+00:00 2026-05-27T22:01:30+00:00

I am using cookies as a remember me function on my site. My method

  • 0

I am using cookies as a remember me function on my site. My method creates a number of cookies which works like a charm, however, I am unable to delete or change these values afterwards.

I create them by:

private function setCookies($userInfo) {
    setcookie("profileID",$userInfo["profileID"],time()+60*60*24*30);
    setcookie("userLevel",$userInfo["levelID"],time()+60*60*24*30);
    setcookie("username",$userInfo["username"],time()+60*60*24*30);
    setcookie("fullname",$userInfo["fullname"],time()+60*60*24*30);
    return true;
}

and my logout method:

public function logout() {
    session_destroy();
    setcookie("profileID","",time()-60*60*24*30*12);
    setcookie("userLevel","",time()-60*60*24*30*12);
    setcookie("username","",time()-60*60*24*30*12);
    setcookie("fullname","",time()-60*60*24*30*12);
    return true;
}

Both these methods are called within a controller file, before any output to the browser (head ect). What makes things worse is that it does not even change the values as list above to “” but remains with the original values.

Any ideas? I have not worked with cookies that much so this could be a simple error 🙂

  • 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-27T22:01:30+00:00Added an answer on May 27, 2026 at 10:01 pm

    Please read the php manual for how to use session_destroy. It talks about cookies and how to destroy them.

    http://php.net/manual/en/function.session-destroy.php

    In order to use the same cookies again, you will need to call session_start() prior to doing so. You’re calling session_destroy() and then trying to set your cookies.

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

Sidebar

Related Questions

How do you delete all the cookies for the current domain using JavaScript?
During sign-in I'm using following function to set cookies and session protected function validateUser($userid,
I would like the VB.net WebClient to remember cookies. I have searched and tried
How to Create 'Remember Me' using Javascript , store cookies any help is appreciated
i see a lot of web site that.. remember when i return without using
Using cookies, I want it to remember the colour layout of the page. (So,
I'm building a .net web app and using Forms authentication with cookies to remember
I'm using signed cookies in Rails 3 to enable a remember-me feature in an
I'm using cookies plugin in my jsTree in order to remember and restore the
I am using a remember me checkbox implemented with a Zend rememberMe function for

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.