1
0

login.php 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. <?php
  2. require_once ($_SERVER['DOCUMENT_ROOT']."/inc/auth.utils.php");
  3. require_once ($_SERVER['DOCUMENT_ROOT']."/inc/languages/" . HTML_LANG . ".php");
  4. $error = '';
  5. if ($_SERVER["REQUEST_METHOD"] == "POST" && isset($_POST['submit'])) {
  6. $login = trim($_POST['login']);
  7. $password = trim($_POST['password']);
  8. // validate if login is empty
  9. if (empty($login)) {
  10. $error .= '<p class="error">'.WEB_msg_login_hint.'.</p>';
  11. }
  12. // validate if password is empty
  13. if (empty($password)) {
  14. $error .= '<p class="error">'.WEB_msg_password_hint.'.</p>';
  15. }
  16. if (empty($error)) {
  17. if (login($db_link)) { header("Location: /admin/index.php"); }
  18. }
  19. }
  20. ?>
  21. <!DOCTYPE html>
  22. <html>
  23. <head>
  24. <title><?php echo WEB_site_title; ?> login</title>
  25. <link rel="stylesheet" type="text/css" href="/css/<?php echo HTML_STYLE.'.css'; ?>">
  26. <link rel="stylesheet" type="text/css" href="/login.css" >
  27. <meta http-equiv="content-type" content="application/xhtml+xml" />
  28. <meta charset="UTF-8" />
  29. </head>
  30. <body>
  31. <div class="login">
  32. <h1><?php echo WEB_msg_login; ?></h1>
  33. <form action="" method="post">
  34. <label for="username">
  35. <i class="fas fa-user"></i>
  36. </label>
  37. <input type="text" name="login" placeholder="<?php echo WEB_msg_username; ?>" id="login" required>
  38. <label for="password">
  39. <i class="fas fa-lock"></i>
  40. </label>
  41. <input type="password" name="password" placeholder="<?php echo WEB_msg_password; ?>" id="password" required>
  42. <input type="submit" name="submit" value="<?php echo WEB_btn_login; ?>">
  43. </form>
  44. </div>
  45. </body>
  46. </html>