ReginaRay

Untitled

Jan 16th, 2017
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.78 KB | None | 0 0
  1. <?php
  2. session_start();
  3.  
  4.  
  5. if($_SESSION['admin']){
  6. header("Location: admin.php");
  7. exit;
  8. }
  9.  
  10. $admin = 'admin';
  11. $pass = 'a029d0df84eb5549c641e04a9ef389e5';
  12. ?>
  13. <p><a href="index.php">Главная</a> | <a href="contact.php">Контакты</a> | <a href="admin.php">Админка</a></p>
  14. <hr />
  15. Это страница авторизации.
  16. <br />
  17. <form method="post">
  18. Username: <input type="text" name="user" /><br />
  19. Password: <input type="password" name="pass" /><br />
  20. <input type="submit" name="submit" value="Войти" />
  21. </form>
  22.  
  23. <?php
  24.  
  25. if($_POST['submit']){
  26. if($admin == $_POST['user'] AND $pass == md5($_POST['pass'])){
  27. $_SESSION['admin'] = $admin;
  28. header("Location: admin.php");
  29. exit;
  30. }else echo '<p>Логин или пароль неверны!</p>';
  31. }
  32.  
  33. ?>
Add Comment
Please, Sign In to add comment