A tumblelog CMS built on AJAX, PHP and MySQL.

login.php 3.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. <?
  2. /* ===========================
  3. gelato CMS development version
  4. http://www.gelatocms.com/
  5. gelato CMS is a free software licensed under GPL (General public license)
  6. =========================== */
  7. ?>
  8. <?
  9. header("Cache-Control: no-cache, must-revalidate");
  10. require( dirname(__FILE__) . '/config.php' );
  11. include(dirname(__FILE__)."/classes/user.class.php");
  12. require_once(dirname(__FILE__)."/classes/configuration.class.php");
  13. $user = new user();
  14. $conf = new configuration();
  15. if ($user->isAdmin()) {
  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. } else {
  22. header("Location: ".$conf->urlGelato."/login.php?error=1");
  23. }
  24. }
  25. else {
  26. ?>
  27. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
  28. <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
  29. <head>
  30. <title>gelato :: Login screen</title>
  31. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  32. <link rel="shortcut icon" href="<?=$conf->urlGelato;?>/images/favicon.ico" />
  33. <script src="<?=$conf->urlGelato;?>/admin/scripts/mootools.js" type="text/javascript"></script>
  34. <style type="text/css" media="screen">
  35. @import "<?=$conf->urlGelato;?>/admin/css/style-codice.css";
  36. </style>
  37. </head>
  38. <body>
  39. <div id="titulo">
  40. <img src="<?=$conf->urlGelato;?>/images/logo.jpg" alt="gelato CMS" title="gelato CMS" />
  41. </div>
  42. <div id="menuContenedor">
  43. <ul>
  44. <li id="active"><a href="<?=$conf->urlGelato;?>/login.php" id="current">Session</a></li>
  45. <ul>
  46. <li id="subactive"><a href="#" id="subcurrent">Begin session</a></li>
  47. </ul>
  48. </li>
  49. <li><a href="index.php">Back to the tumblelog</a></li>
  50. </ul>
  51. </div>
  52. <div id="contenido">
  53. <div class="piccola">
  54. <div class="ventana">
  55. <p class="titulo"><span class="handle" style="cursor:move;">Ingresar al sistema</span></p>
  56. <div id="formulario">
  57. <form action="login.php" method="post" id="valida" autocomplete="off">
  58. <fieldset>
  59. <p><label for="login">User:</label>
  60. <input id="login" name="login" type="text" class="input-corto" /></p>
  61. <p><label for="pass">Password:</label>
  62. <input id="pass" name="pass" type="password" class="input-corto" /></p>
  63. <p><label for="save_pass">Remember me:</label>
  64. <input id="save_pass" name="save_pass" type="checkbox" class="check" /></p>
  65. <p><input class="submit" name="btnLogin" type="submit" value="Login" /></p>
  66. </fieldset>
  67. </form>
  68. <?
  69. if (isset($_GET["error"])) {
  70. if ($_GET["error"]==1) {
  71. ?>
  72. <div class="error">
  73. &nbsp;You must be registered to use gelato.
  74. </div>
  75. <?
  76. }
  77. elseif ($_GET["error"]==2) {
  78. ?>
  79. <div class="error">
  80. &nbsp;You must be logged on the system.
  81. </div>
  82. <?
  83. }
  84. }
  85. ?>
  86. </div>
  87. </p>
  88. </div>
  89. </div>
  90. <div id="pie">
  91. <p>
  92. <a href="http://www.gelatocms.com/" title="gelato CMS" target="_blank">gelato CMS</a> :: PHP/MySQL Tumblelog Content Management System.
  93. </p>
  94. </div>
  95. </div>
  96. </body>
  97. </html>
  98. <?
  99. }
  100. }
  101. ?>