A tumblelog CMS built on AJAX, PHP and MySQL.

login.php 4.0KB

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