0

I'm running some "Would you like to save password for this site" tests, so I created a simple PHP code that does a SESSION login.

The following code works, but none of Firefox, Safari, IE8 or Chrome prompts me to save password for this website, any ideas?

<?php
session_start();

if (isset ($_GET['logout'])) {
    session_destroy();
    header('Location: index.php');
    exit;
}

if (isset ($_POST['user']) && $_POST['password'] == 'admin') {
    $_SESSION['user'] = 'ok';
}
?>

<?php if (isset($_SESSION['user'])) { ?>
<h1>Welcome</h1>
<a href="index.php?logout">logout</a>
<?php } else { ?>
<form action="index.php" method="POST">
    <input type="text" name="user" value="admin">
    <input type="password" name="password">
    <button type="submit">login</button>
</form>
<?php } ?>
daisy
  • 22,498
  • 29
  • 129
  • 265

0 Answers0