A tumblelog CMS built on AJAX, PHP and MySQL.

admin.php 4.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  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. require_once('../config.php');
  10. include("../classes/user.class.php");
  11. require_once("../classes/configuration.class.php");
  12. $user = new user();
  13. $conf = new configuration();
  14. if ($user->isAdmin()) {
  15. ?>
  16. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
  17. <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
  18. <head>
  19. <title>gelato</title>
  20. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  21. <link rel="shortcut icon" href="<?=$conf->urlGelato;?>/images/favicon.ico" />
  22. <script language="javascript" type="text/javascript" src="<?=$conf->urlGelato;?>/admin/scripts/mootools.js"></script>
  23. <style type="text/css" media="screen">
  24. @import "<?=$conf->urlGelato;?>/admin/css/style-codice.css";
  25. </style>
  26. </head>
  27. <body>
  28. <div id="div-process" style="display:none;">Processing request...</div>
  29. <div id="titulo">
  30. <img src="<?=$conf->urlGelato;?>/images/logo.jpg" alt="gelato CMS" title="gelato CMS" />
  31. </div>
  32. <div id="menuContenedor">
  33. <ul>
  34. <li id="active"><a href="#" id="current">Users</a></li>
  35. <ul>
  36. <li><a href="user.php">Add</a></li>
  37. <li id="subactive"><a href="#" id="subcurrent">Manage</a></li>
  38. </ul>
  39. </li>
  40. <li><a href="index.php">Control Panel</a></li>
  41. </ul>
  42. </div>
  43. <div id="contenido">
  44. <div class="center">
  45. <div class="ventana">
  46. <p class="titulo"><span class="handle">Manage the user information</span></p>
  47. <div id="formulario">
  48. <?
  49. if (isset($_GET["added"])) {
  50. if ($_GET["added"]=="true") {
  51. echo "<div class=\"exito\">The user has been added successfully.</div>";
  52. }
  53. }
  54. if (isset($_GET["delete"])) {
  55. if ($_GET["delete"]=="true") {
  56. echo "<div class=\"exito\">The user has been eliminated successfully.</div>";
  57. }
  58. }
  59. if (isset($_GET["modified"])) {
  60. if ($_GET["modified"]=="true") {
  61. echo "<div class=\"exito\">The user has been modified successfully.</div>";
  62. }
  63. }
  64. if (isset($_GET["error"])) {
  65. if ($_GET["error"]==1) {
  66. echo "<div class=\"error\">The username is not available.</div>";
  67. } elseif ($_GET["error"]==2) {
  68. echo "<div class=\"error\"><strong>Error on the database server: </strong>".$_GET["des"]."</div>";
  69. }
  70. }
  71. ?>
  72. <p>
  73. <table class="sortable" id="admin-tabla">
  74. <caption>Authors list.</caption>
  75. <thead>
  76. <tr>
  77. <th scope="col">Login</th>
  78. <th scope="col">Name</th>
  79. <th colspan="2" scope="col" class="unsortable">Actions</th>
  80. </tr>
  81. </thead>
  82. <tbody>
  83. <?
  84. $odd=false;
  85. $rs = $user->getUsers();
  86. if ($user->contarRegistros()>0) {
  87. while($register = mysql_fetch_array($rs)) {
  88. ?>
  89. <tr <? if ($odd) { echo 'class="odd"'; } $odd=!$odd; ?>>
  90. <td>
  91. <? echo $register["login"]."\n"; ?>
  92. </td>
  93. <td>
  94. <? echo $register["name"]."\n"; ?>
  95. </td>
  96. <td>
  97. <a href="user.php?edit=<?=$register["id_user"]; ?>">Edit</a>
  98. </td>
  99. <td>
  100. <a href="user.php?delete=<?=$register["id_user"]; ?>">Delete</a>
  101. </td>
  102. </tr>
  103. <?
  104. }
  105. }
  106. else {
  107. ?>
  108. <tr>
  109. <td colspan="4"><div class="exito">No users available.</div></td>
  110. </tr>
  111. <?
  112. }
  113. ?>
  114. </tbody>
  115. </table>
  116. </p>
  117. <p>&nbsp;</p>
  118. </div>
  119. </div>
  120. </div>
  121. <div id="pie">
  122. <p>
  123. <a href="http://www.gelatocms.com/" title="gelato CMS" target="_blank">gelato CMS</a> :: PHP/MySQL Tumblelog Content Management System.
  124. </p>
  125. </div>
  126. </div>
  127. </body>
  128. </html>
  129. <?
  130. } else {
  131. header("Location: ".$conf->urlGelato."/login.php");
  132. }
  133. ?>