A tumblelog CMS built on AJAX, PHP and MySQL.

login.php 1.6KB

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