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

The Archive Base Latest Questions

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

I am using the php authentication method for digest authentication as shown on the

  • 0

I am using the php authentication method for digest authentication as shown on the php manual. All is working well except for the logout part.

I am using session_destroy() to try and log my users out, which it does. However my problem is if the user goes to log back in before closing the browser out they are not prompted for a username and password and they are automatically logged back in with the last username and password they entered.

It seems the credentials are somehow being remembered by the browser. In Firefox if I manually clear “active logins” in the “clear browsing history” before trying to log back in then I am prompted for the username and password even though the user has been logged out with session_destroy().

I am also using an example from the php manual to clear the cookie but that doesn’t seem to help, it doesn’t seem to be a cookie problem.

Here is my logout.php code

<?php
session_start();
$_SESSION = array();
//destroy cookie if it exists
if (ini_get("session.use_cookies")) {
    $params = session_get_cookie_params();
    setcookie(session_name(), '', time() - 42000,
        $params["path"], $params["domain"],
        $params["secure"], $params["httponly"]
    );
}
//destroy session
session_destroy();
header("location:form.php");
exit();
?>

What am I missing? Thanks for any help!

  • 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-23T15:54:06+00:00Added an answer on May 23, 2026 at 3:54 pm

    HTTP Auth works slightly different then authentication with session.
    The only possibility to clear a http Auth session is to change the realm name.
    Check http://www.php.net/manual/en/features.http-auth.php#100396 (Comment #100396) it’s where I found out.

    BTW: It’s a lot easier to use sessions for authentication, you have a lot more possibilities to store user information etc. so if there is no certain reason for httpAuth you might be better with using sessions.

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

Sidebar

Related Questions

I am working on an authentication system for an online game programmed using PHP
I have just succeeded in creating oAuth authentication for my twitter application using PHP.
what are the benefits of using HTTP authentication with PHP (HTTP 401 headers) instead
I wrote a class to authenticate a user using HTTP Authentication the Digest way.
I am using PHP and the codeigniter framework for a project I am working
Background: Hi, I'm using PHP 5.3 on a Windows 7 machine as a part
Being unable to locate a working php/javascript implementation of blowfish, I'm now considering using
I'm trying to design a two factor authentication system (on PHP) using SMS as
i am using mail() function to send email from PHP without any authentication. This
I would create a login authentication using php, The requirement is : one username

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.