Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- session_start();
- if (!isset($_SESSION['isLogged'])) {
- $_SESSION['isLogged'] = NULL;
- }
- $pageTitle = 'Вход';
- if (isset($_POST['login'])) {
- $username = trim($_POST['username']);
- $password = trim($_POST['password']);
- if ($username == 'user' && $password == 'qwerty') {
- $_SESSION['isLogged'] = true;
- unset($_POST);
- header('Location:index.php');
- } else {
- echo 'Грешно Име/Парола';
- }
- }
- require 'header.php';
- if (isset($_SESSION['isLogged'])) {
- echo 'Логнат <br/>';
- echo '<a href="logout.php";>Излез</a>';
- }
- ?>
- <?php if (!isset($_SESSION['isLogged'])) : ?>
- <form method="POST" action="index.php" >
- Име:
- <input type="text" name="username" />
- <br/>
- Парола:
- <input type="password" name="password" />
- <br/>
- <input type="submit" name="login" value="Вход" />
- </form>
- <?php endif; ?>
- <?php require 'footer.php'; ?>
Advertisement
Add Comment
Please, Sign In to add comment