J
J
joomla72020-05-30 22:03:50
PHP
joomla7, 2020-05-30 22:03:50

How to remove the authorization form after login?

After successful registration, you need to delete the authorization and registration form, and leave the "Good afternoon $fio" and the exit button.

<?php
session_start();
require('reg.php');
if (isset($_POST['fio']) and isset($_POST['pass'])){
$fio = $_POST['fio'];
$pass = $_POST['pass'];
$query = "SELECT * FROM users WHERE fio='$fio' and pass='$pass'";
$result = mysqli_query($connection, $query) or die (mysqli_error($connection));
$count = mysqli_num_rows($result);
if ($count == 1) {
$_SESSION['fio'] = $fio;
} else {
$fmsg = "Неверные данные";
}
}
if (isset($_SESSION['fio'])) {
  $fio = $_SESSION['fio'];
$smsg = "Доброго дня </br> $fio <a href='logout.php' type='submit' class='primary-btn'>Выйти</a>";
  }
?>

  <!--================Login Box Area =================-->
  <section class="login_box_area section_gap">
    <div class="container">
      <div class="row">
        <div class="col-lg-6">
          <div class="login_box_img">
            <img class="img-fluid" src="img/login.jpg" alt="">
            <div class="hover">
              <h4>Впервые на сайте?</h4>
              <p>Что бы получить больше функций на сайте, и возможность приобретения автомобиля, пожалуйста зарегистрируйтесь</p>
              <a class="primary-btn" href="registration.php">Создание аккаунта</a>
            </div>
          </div>
        </div>

        <div class="col-lg-6">
          <div class="login_form_inner">
            <h3>Уже зарегистрированы?</h3>
            <form class="row login_form" method="POST" id="contactForm" novalidate="novalidate">
              <div class="col-md-12 form-group">
                <input type="text" class="form-control" id="fio" name="fio" placeholder="Логин" required>
              </div>
              <div class="col-md-12 form-group">
                <input type="password" class="form-control" id="pass" name="pass" placeholder="Пароль" required>
              </div>
              <div class="col-md-12 form-group">
                <div class="creat_account">
                  <input type="checkbox" id="f-option2" name="selector">
                  <label for="f-option2">Запомнить меня</label>
                </div>
              </div>
              <div class="col-md-12 form-group">
                <button type="submit" class="primary-btn">Войти</button>
                <?php if(isset($fmsg)){ ?><div class="alert alert-danger" role="alert"> <?php echo $fmsg; ?> </div><?php }?>
                <?php if(isset($smsg)){ ?><div class="alert alert-success" role="alert"> <?php echo $smsg;  ?> </div><center><a href='logout.php' class='primary-btn'></a></center><?php }?>
                <a href="#">Забыли пароль?</a>
              </div>
            </form>
          </div>
        </div>
      </div>
    </div>
  </section>

  <!--================End Login Box Area =================-->

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question