A tumblelog CMS built on AJAX, PHP and MySQL.

login.php 1.5KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. <?php
  2. if (!defined('entry')) {
  3. define('entry', true);
  4. }
  5. /* ===========================
  6. Sorbet CMS - A PHP based tumblelog CMS forked from Gelato CMS
  7. Sorbet CMS is a free software licensed under the GPL 3.0
  8. =========================== */
  9. ?>
  10. <?php
  11. header("Cache-Control: no-cache, must-revalidate");
  12. require_once('entry.php');
  13. global $user, $conf;
  14. if ($user->isAuthenticated()) {
  15. header("Location: ".$conf->urlSorbet."/admin/index.php");
  16. } else {
  17. if (isset($_POST["pass"]) && isset($_POST["login"])) {
  18. if ($user->validateUser($_POST['login'], md5($_POST['pass']))) {
  19. if (isset($_POST["url_redirect"])) {
  20. header("Location: ".$conf->urlSorbet."/admin/bm.php?url=".$_POST["url_redirect"]."&sel=".$_POST["sel"]);
  21. exit();
  22. } else {
  23. header("Location: ".$conf->urlSorbet."/admin/index.php");
  24. exit();
  25. }
  26. } else {
  27. header("Location: ".$conf->urlSorbet."/login.php?error=1");
  28. exit();
  29. }
  30. } else {
  31. $theme = new themes;
  32. $util_class = new util();
  33. $theme->set('version', $util_class->version());
  34. $theme->set('redirect_url', (isset($_GET['redirect_url'])?$_GET['redirect_url']:''));
  35. $theme->set('sel', (isset($_GET['sel'])?$_GET['sel']:''));
  36. $theme->set('error', (isset($_GET['error'])?$_GET['error']:''));
  37. $theme->set('conf', array(
  38. "urlSorbet"=>$conf->urlSorbet
  39. ));
  40. $theme->display(Absolute_Path.'admin/themes/admin/login.htm');
  41. }
  42. }
  43. ?>