A tumblelog CMS built on AJAX, PHP and MySQL.

login.php 3.6KB

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