0

I have created a login/logout system in my application but it's not working even using session_start();, session_destroy(); and session_unset (); etc.

Here is what I have done so far:

the first page (login)

<?php
    if(
    !isset($_SERVER['PHP_AUTH_USER'])||
    !isset($_SERVER['PHP_AUTH_PW'])||
    ($_SERVER['PHP_AUTH_USER'])!="admin"||
    ($_SERVER['PHP_AUTH_PW']!="admin")
     )
{
header('WWW-Authenticate: Basic realm="Accès refusé"');
echo 'Accès refusé';
exit;
}
else
session_start (); 
$_SESSION['PHP_AUTH_USER'] = "admin"; 
$_SESSION['PHP_AUTH_PW'] = "admin"; 
echo '

and this is the logout part

<?php

session_start();
session_unset ();
session_destroy(); 
header("Location: index.php");
die;    
?>

The problem is that the session is not destroyed, even when clicking the logout button.

Funk Forty Niner
  • 74,450
  • 15
  • 68
  • 141
user2507171
  • 74
  • 2
  • 12

1 Answers1

1

Create another login/logout system, it's not hard.

Community
  • 1
  • 1
sectus
  • 15,605
  • 5
  • 55
  • 97