A tumblelog CMS built on AJAX, PHP and MySQL.

login.php 4.1KB

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