S
S
ssvv962020-05-08 14:14:40
PHP
ssvv96, 2020-05-08 14:14:40

How to display login after successful authorization?

What is the best way to display login upon successful authorization in input id="login_id" size="30" name="login"

<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <link href="/stylelayout.css" rel="stylesheet">
    <title>Project - ведение списков</title>
</head>

<body>

    <div class="header">
    	<div class="logo"><img src=/i/logo.png width="68" height="23" alt="Project"></div>
        <div class="clearfix"></div>
    </div>

    <div class="clear">
        <ul class="main-menu">
            <li><a href="#">Главная</a></li>
            <li><a href="#">О нас</a></li>
            <li><a href="#">Контакты</a></li>
            <li><a href="#">Новости</a></li>
            <li><a href="#">Каталог</a></li>
        </ul>
    </div>

  <table width="100%" boarder="0" cellspacing="0" cellpadding="0">
    	<tr>
        	<td class="left-collum-index">
      
        <h1>Возможности проекта —</h1>
        <p>Вести свои личные списки, например покупки в магазине, цели, задачи и многое другое. Делится списками с друзьями и просматривать списки друзей.</p>
        
      
      </td>
            <td class="right-collum-index">
        
        <div class="project-folders-menu">
          <ul class="project-folders-v">
    					<li class="project-folders-v-active"><a href="/?login=yes">Авторизация</a></li>
    					<li><a href="#">Регистрация</a></li>
    					<li><a href="#">Забыли пароль?</a></li>
          </ul>
            <div class="clearfix"></div>
        </div>
                
        <div class="index-auth">
                <?php
 
if (!empty($_POST && isset($_POST['auth']))) {
    $logins = $_SERVER['DOCUMENT_ROOT'] . '/data/login.php';
    $passwords = $_SERVER['DOCUMENT_ROOT'] . '/data/password.php';
 
    $login = $_POST['login'] ?? '';
    $pass = $_POST['pass'] ?? '';
    isset($_POST['auth']);

    $k = array_search($login, $logins);
    if ($k !== false) {
        $passwords[$k] != $pass ?: include $_SERVER['DOCUMENT_ROOT'] . '/include/success.php';

        } else {
            include $_SERVER['DOCUMENT_ROOT'] . '/include/error.php';
        }
    }

 
?>
                <?php if(isset($_GET['login']) && $_GET['login']=='yes')
                {
  ?>
                    <form action="/login=yes" method="post">
              
            <table width="100%" boarder="0" cellspacing="0" cellpadding="0">
              <tr>
                <td class="iat">
                                    <label for="login_id">Ваш e-mail:</label>
                                    <input id="login_id" size="30" name="login">
                                </td>
              </tr>
              <tr>
                <td class="iat">
                                    <label for="password_id">Ваш пароль:</label>
                                    <input id="password_id" size="30" name="password" type="password">
                            
      
                                </td>
              </tr>
              <tr>
                <td><input type="submit" value="Войти" name="auth"></td>
                                <?php
                }
                ?>
              </tr>
            </table>
                    </form>
        </div>
      
      </td>
        </tr>
    </table>
    
    <div class="clearfix">
        <ul class="main-menu bottom">
            <li><a href="#">Главная</a></li>
            <li><a href="#">О нас</a></li>
            <li><a href="#">Контакты</a></li>
            <li><a href="#">Новости</a></li>
            <li><a href="#">Каталог</a></li>
        </ul>
    </div>

    <div class="footer">&copy;&nbsp;<nobr>2018</nobr> Project.</div>

</body>
</html>

Answer the question

In order to leave comments, you need to log in

1 answer(s)
E
Evgeny Neverov, 2020-05-08
@ssvv96

<input id="login_id" size="30" name="login" value="<?=$login ?? null ?>">

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question