I understand that there is no "real solution" to logging out of http as it is stateless. However, all I need is a workaround. The one that I am trying to achieve is when a logout link is clicked it redirects to the logout.php file. That file calls the basic auth header again. I want to have php code pass a bogus password in, and then redirect to my homepage where the user will "be logged out".
I realize they would not actually be logged out, but rather the browser will be attempting to use the most recent auth credentials which will have been passed in and are incorrect, therefore making the user re log in with valid ones.
I have basically no php experience and cannot figure out how to code up the passing of a false password.
Any help is appreciated.
logout.php
<?php
session_start();
session_write_close();
header('HTTP/1.1 401 Access Denied');
header('WWW-Authenticate: Basic realm="HTTPS File Upload"');
header('HTTP/1.0 401 Unauthorized');
header('Location: http://www.homepage.com')
?>