A tumblelog CMS built on AJAX, PHP and MySQL.

login.php 3.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. <?php
  2. /* ===========================
  3. gelato CMS - A PHP based tumblelog CMS
  4. development version
  5. http://www.gelatocms.com/
  6. gelato CMS is a free software licensed under the GPL 2.0
  7. Copyright (C) 2007 by Pedro Santana <pecesama at gmail dot com>
  8. =========================== */
  9. ?>
  10. <?php
  11. header("Cache-Control: no-cache, must-revalidate");
  12. require( dirname(__FILE__) . '/config.php' );
  13. include(dirname(__FILE__)."/classes/functions.php");
  14. include(dirname(__FILE__)."/classes/user.class.php");
  15. require_once(dirname(__FILE__)."/classes/configuration.class.php");
  16. $user = new user();
  17. $conf = new configuration();
  18. if ($user->isAdmin()) {
  19. header("Location: ".$conf->urlGelato."/admin/index.php");
  20. } else {
  21. if (isset($_POST["pass"]) && isset($_POST["login"])) {
  22. if ($user->validateUser($_POST['login'], md5($_POST['pass']))) {
  23. header("Location: ".$conf->urlGelato."/admin/index.php");
  24. } else {
  25. header("Location: ".$conf->urlGelato."/login.php?error=1");
  26. }
  27. }
  28. else {
  29. ?>
  30. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  31. <html xmlns="http://www.w3.org/1999/xhtml">
  32. <head>
  33. <title>gelato :: <?php echo __("login screen")?></title>
  34. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  35. <meta name="generator" content="gelato cms <?php echo version();?>" />
  36. <link rel="shortcut icon" href="<?php echo $conf->urlGelato;?>/images/favicon.ico" />
  37. <script language="javascript" type="text/javascript" src="<?php echo $conf->urlGelato;?>/admin/scripts/mootools.js"></script>
  38. <script language="javascript" type="text/javascript" src="<?php echo $conf->urlGelato;?>/admin/scripts/sortable.js"></script>
  39. <style type="text/css" media="screen">
  40. @import "<?php echo $conf->urlGelato;?>/admin/css/style.css";
  41. </style>
  42. </head>
  43. <body>
  44. <div id="div-process" style="display:none;"><?php echo __("Processing request...")?></div>
  45. <div id="cont">
  46. <div id="head">
  47. <h1><a href="<?php echo $conf->urlGelato;?>/" title="gelato :: <?php echo __("home")?>">gelato cms</a></h1>
  48. <ul id="nav">
  49. <li><a href="<?php echo $conf->urlGelato;?>/" title="<?php echo __("Take me to the tumblelog")?>"><?php echo __("Back to the Tumblelog")?></a></li>
  50. </ul>
  51. </div>
  52. <div id="main">
  53. <div class="box">
  54. <ul class="menu manage">
  55. <h3><?php echo __("Start session")?></h3>
  56. <li class="selected"><a><?php echo __("Login")?></a></li>
  57. </ul>
  58. <div class="tabla">
  59. <form action="login.php" method="post" id="valida" autocomplete="off" class="newpost">
  60. <fieldset>
  61. <ul>
  62. <li><label for="login"><?php echo __("User:")?></label>
  63. <input id="login" name="login" type="text" class="txt" /></li>
  64. <li><label for="pass"><?php echo __("Password:")?></label>
  65. <input id="pass" name="pass" type="password" class="txt" /></li>
  66. <li><label for="save_pass"><?php echo __("Remember me:")?></label>
  67. <input id="save_pass" name="save_pass" type="checkbox" /></li>
  68. <li><input name="btnLogin" type="submit" value="Login" /></li>
  69. </ul>
  70. </fieldset>
  71. </form>
  72. <?php
  73. if (isset($_GET["error"])) {
  74. if ($_GET["error"]==1) {
  75. ?>
  76. <div class="error">
  77. <?php echo __("&nbsp;You must be registered to use gelato.")?>
  78. </div>
  79. <?php
  80. }
  81. elseif ($_GET["error"]==2) {
  82. ?>
  83. <div class="error">
  84. <?php echo __("&nbsp;You must be logged on the system.")?>
  85. </div>
  86. <?php
  87. }
  88. }
  89. ?>
  90. </div>
  91. <div class="footer-box">&nbsp;</div>
  92. </div>
  93. </div>
  94. <div id="foot">
  95. <a href="http://www.gelatocms.com/" title="gelato CMS">gelato CMS</a> :: PHP/MySQL Tumblelog Content Management System.
  96. </div>
  97. </div>
  98. </body>
  99. </html>
  100. <?php
  101. }
  102. }
  103. ?>