A tumblelog CMS built on AJAX, PHP and MySQL.

login.php 3.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  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. //print "<pre>"; print_r($_SESSION); print "</pre>";die();
  20. if ($user->validateUser($_POST['login'], md5($_POST['pass']))) {
  21. header("Location: ".$conf->urlGelato."/admin/index.php");
  22. } else {
  23. header("Location: ".$conf->urlGelato."/login.php?error=1");
  24. }
  25. } else {
  26. ?>
  27. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  28. <html xmlns="http://www.w3.org/1999/xhtml">
  29. <head>
  30. <title>gelato :: <?php echo __("login screen")?></title>
  31. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  32. <meta name="generator" content="gelato cms <?php echo version();?>" />
  33. <link rel="shortcut icon" href="<?php echo $conf->urlGelato;?>/images/favicon.ico" />
  34. <script language="javascript" type="text/javascript" src="<?php echo $conf->urlGelato;?>/admin/scripts/mootools.js"></script>
  35. <script language="javascript" type="text/javascript" src="<?php echo $conf->urlGelato;?>/admin/scripts/sortable.js"></script>
  36. <style type="text/css" media="screen">
  37. @import "<?php echo $conf->urlGelato;?>/admin/css/style.css";
  38. </style>
  39. </head>
  40. <body>
  41. <div id="div-process" style="display:none;"><?php echo __("Processing request&hellip;")?></div>
  42. <div id="cont">
  43. <div id="head">
  44. <h1><a href="<?php echo $conf->urlGelato;?>/" title="gelato :: <?php echo __("home")?>">gelato cms</a></h1>
  45. <ul id="nav">
  46. <li><a href="<?php echo $conf->urlGelato;?>/" title="<?php echo __("Take me to the tumblelog")?>"><?php echo __("Back to the Tumblelog")?></a></li>
  47. </ul>
  48. </div>
  49. <div id="main">
  50. <div class="box">
  51. <ul class="menu manage">
  52. <h3><?php echo __("Start session")?></h3>
  53. <li class="selected"><a><?php echo __("Login")?></a></li>
  54. </ul>
  55. <div class="tabla">
  56. <form action="login.php" method="post" id="valida" autocomplete="off" class="newpost">
  57. <fieldset>
  58. <ul>
  59. <li><label for="login"><?php echo __("User:")?></label>
  60. <input id="login" name="login" type="text" class="txt" /></li>
  61. <li><label for="pass"><?php echo __("Password:")?></label>
  62. <input id="pass" name="pass" type="password" class="txt" /></li>
  63. <li><label for="save_pass"><?php echo __("Remember me:")?></label>
  64. <input id="save_pass" name="save_pass" type="checkbox" /></li>
  65. <li><input name="btnLogin" type="submit" value="Login" /></li>
  66. </ul>
  67. </fieldset>
  68. </form>
  69. <?php
  70. if (isset($_GET["error"])) {
  71. if ($_GET["error"]==1) {
  72. ?>
  73. <div class="error">
  74. <?php echo __("&nbsp;You must be registered to use gelato.")?>
  75. </div>
  76. <?php
  77. }
  78. elseif ($_GET["error"]==2) {
  79. ?>
  80. <div class="error">
  81. <?php echo __("&nbsp;You must be logged on the system.")?>
  82. </div>
  83. <?php
  84. }
  85. }
  86. ?>
  87. </div>
  88. <div class="footer-box">&nbsp;</div>
  89. </div>
  90. </div>
  91. <div id="foot">
  92. <a href="http://www.gelatocms.com/" title="gelato CMS">gelato CMS</a> :: PHP/MySQL Tumblelog Content Management System.
  93. </div>
  94. </div>
  95. </body>
  96. </html>
  97. <?php
  98. }
  99. }
  100. ?>