A tumblelog CMS built on AJAX, PHP and MySQL.

login.php 3.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. <?php
  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. <?php
  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.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 :: login screen</title>
  31. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  32. <link rel="shortcut icon" href="<?php echo $conf->urlGelato;?>/images/favicon.ico" />
  33. <script language="javascript" type="text/javascript" src="<?php echo $conf->urlGelato;?>/admin/scripts/mootools.js"></script>
  34. <script language="javascript" type="text/javascript" src="<?php echo $conf->urlGelato;?>/admin/scripts/sortable.js"></script>
  35. <style type="text/css" media="screen">
  36. @import "<?php echo $conf->urlGelato;?>/admin/css/style.css";
  37. </style>
  38. </head>
  39. <body>
  40. <div id="div-process" style="display:none;">Processing request...</div>
  41. <div id="cont">
  42. <div id="head">
  43. <h1><a href="<?php echo $conf->urlGelato;?>/" title="gelato :: home">gelato cms</a></h1>
  44. <ul id="nav">
  45. <li><a href="<?php echo $conf->urlGelato;?>/" title="Take me to the tumblelog">Back to the Tumblelog</a></li>
  46. </ul>
  47. </div>
  48. <div id="main">
  49. <div class="box">
  50. <ul class="menu manage">
  51. <h3>Start session</h3>
  52. <li class="selected"><a href="#">Login</a></li>
  53. </ul>
  54. <div class="tabla">
  55. <form action="login.php" method="post" id="valida" autocomplete="off" class="newpost">
  56. <fieldset>
  57. <ul>
  58. <li><label for="login">User:</label>
  59. <input id="login" name="login" type="text" class="txt" /></li>
  60. <li><label for="pass">Password:</label>
  61. <input id="pass" name="pass" type="password" class="txt" /></li>
  62. <li><label for="save_pass">Remember me:</label>
  63. <input id="save_pass" name="save_pass" type="checkbox" /></li>
  64. <li><input name="btnLogin" type="submit" value="Login" /></li>
  65. </ul>
  66. </fieldset>
  67. </form>
  68. <?php
  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. <?php
  76. }
  77. elseif ($_GET["error"]==2) {
  78. ?>
  79. <div class="error">
  80. &nbsp;You must be logged on the system.
  81. </div>
  82. <?php
  83. }
  84. }
  85. ?>
  86. </div>
  87. <div class="footer-box">&nbsp;</div>
  88. </div>
  89. </div>
  90. <div id="foot">
  91. <a href="http://www.gelatocms.com/" title="gelato CMS">gelato CMS</a> :: PHP/MySQL Tumblelog Content Management System.
  92. </div>
  93. </div>
  94. </body>
  95. </html>
  96. <?php
  97. }
  98. }
  99. ?>