fabi0

Untitled

Oct 1st, 2013
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.99 KB | None | 0 0
  1. <?php
  2. session_start();
  3. if (!isset($_SESSION['isLogged'])) {
  4.     $_SESSION['isLogged'] = NULL;
  5. }
  6. $pageTitle = 'Вход';
  7. if (isset($_POST['login'])) {
  8.     $username = trim($_POST['username']);
  9.     $password = trim($_POST['password']);
  10.     if ($username == 'user' && $password == 'qwerty') {
  11.         $_SESSION['isLogged'] = true;
  12.         unset($_POST);
  13.         header('Location:index.php');
  14.     } else {
  15.         echo 'Грешно Име/Парола';
  16.     }
  17. }
  18. require 'header.php';
  19. if (isset($_SESSION['isLogged'])) {
  20.     echo 'Логнат <br/>';
  21.     echo '<a href="logout.php";>Излез</a>';
  22. }
  23. ?>
  24. <?php if (!isset($_SESSION['isLogged'])) : ?>
  25.     <form  method="POST" action="index.php" >
  26.         Име:
  27.         <input type="text" name="username" />
  28.         <br/>
  29.         Парола:
  30.         <input type="password" name="password" />
  31.         <br/>
  32.         <input type="submit" name="login" value="Вход" />    
  33.     </form>
  34. <?php endif; ?>
  35. <?php require 'footer.php'; ?>
Advertisement
Add Comment
Please, Sign In to add comment