0

Tell me please, there is a code that opens a php session:

<?php
session_start();
$admin_login="Admin"; //Логин админа
$admin_password="superpass"; //Пароль админа

if(isset($_POST['password'])):
$_SESSION[$_POST['login']]=$_POST['password'];
header("Location: {$_SERVER['PHP_SELF']}");
exit;
endif;

if($_SESSION[$admin_login]!=$admin_password)
{
?>
<link rel="stylesheet" href="/4/style.css">
<form action="<?php $_SERVER['PHP_SELF']; ?>" method="POST" id="login">
 <h1>Форма входа</h1>
    <fieldset id="inputs">
        <input id="username" type="text" name="login" placeholder="Логин" autofocus required>   
        <input id="password" type="password" name="password" placeholder="Пароль" required>
    </fieldset>
    <fieldset id="actions">
        <input type="submit" id="submit" value="ВОЙТИ">
    </fieldset>
</form>
<?php
exit;
}
else
{
   ?>

   <a href='/4/exit.php'>Выход</a>

<?php
}
?>

When you create and delete a session, an error is recorded in the error_log

PHP Notice: Undefined index: Admin in / home / 4 / index.php on line 12

What could be the problem?

0 Answers0