A tumblelog CMS built on AJAX, PHP and MySQL.

login.php 1.4KB

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