A tumblelog CMS built on AJAX, PHP and MySQL.

login.php 4.2KB

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