A tumblelog CMS built on AJAX, PHP and MySQL.

login.php 3.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  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. <style type="text/css" media="screen">
  35. @import "<?php echo $conf->urlGelato;?>/admin/css/style.css";
  36. </style>
  37. </head>
  38. <body>
  39. <div id="div-process" style="display:none;"><?php echo __("Processing request&hellip;")?></div>
  40. <div id="cont">
  41. <div id="head">
  42. <h1><a href="<?php echo $conf->urlGelato;?>/" title="gelato :: <?php echo __("home")?>">gelato cms</a></h1>
  43. <ul id="nav">
  44. <li><a href="<?php echo $conf->urlGelato;?>/" title="<?php echo __("Take me to the tumblelog")?>"><?php echo __("Back to the Tumblelog")?></a></li>
  45. </ul>
  46. </div>
  47. <div id="main">
  48. <div class="box">
  49. <ul class="menu manage">
  50. <h3><?php echo __("Start session")?></h3>
  51. <li class="selected"><a><?php echo __("Login")?></a></li>
  52. </ul>
  53. <div class="tabla">
  54. <form action="login.php" method="post" id="valida" autocomplete="off" class="newpost">
  55. <fieldset>
  56. <ul>
  57. <li><label for="login"><?php echo __("User:")?></label>
  58. <input id="login" name="login" type="text" class="txt" /></li>
  59. <li><label for="pass"><?php echo __("Password:")?></label>
  60. <input id="pass" name="pass" type="password" class="txt" /></li>
  61. <li><label for="save_pass"><?php echo __("Remember me:")?></label>
  62. <input id="save_pass" name="save_pass" type="checkbox" /></li>
  63. <li><input name="btnLogin" type="submit" value="Login" /></li>
  64. </ul>
  65. </fieldset>
  66. </form>
  67. <?php
  68. if (isset($_GET["error"])) {
  69. if ($_GET["error"]==1) {
  70. ?>
  71. <div class="error">
  72. <?php echo __("&nbsp;You must be registered to use gelato.")?>
  73. </div>
  74. <?php
  75. }
  76. elseif ($_GET["error"]==2) {
  77. ?>
  78. <div class="error">
  79. <?php echo __("&nbsp;You must be logged on the system.")?>
  80. </div>
  81. <?php
  82. }
  83. }
  84. ?>
  85. </div>
  86. <div class="footer-box">&nbsp;</div>
  87. </div>
  88. </div>
  89. <div id="foot">
  90. <a href="http://www.gelatocms.com/" title="gelato CMS">gelato CMS</a> :: PHP/MySQL Tumblelog Content Management System.
  91. </div>
  92. </div>
  93. </body>
  94. </html>
  95. <?php
  96. }
  97. }
  98. ?>