A tumblelog CMS built on AJAX, PHP and MySQL.

user.php 5.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  1. <?php
  2. if (!defined('entry')) {
  3. define('entry', true);
  4. }
  5. /* ===========================
  6. gelato CMS - A PHP based tumblelog CMS
  7. development version
  8. http://www.gelatocms.com/
  9. gelato CMS is a free software licensed under the GPL 2.0
  10. Copyright (C) 2007 by Pedro Santana <pecesama at gmail dot com>
  11. =========================== */
  12. ?>
  13. <?php
  14. require('../entry.php');
  15. global $user, $conf, $tumble;
  16. $isEdition = isset($_GET["edit"]);
  17. $userId = ($isEdition) ? $_GET["edit"] : null;
  18. if ($user->isAdmin()) {
  19. if (isset($_GET["delete"])) {
  20. $user->deleteUser($_GET['delete']);
  21. header("Location: admin.php?delete=true");
  22. die();
  23. }
  24. if (isset($_POST["btnAdd"])) {
  25. unset($_POST["btnAdd"]);
  26. if (isset($_POST["repass"])) {
  27. unset($_POST["repass"]);
  28. }
  29. if (isset($_POST["btnVerifyUser"])) {
  30. unset($_POST["btnVerifyUser"]);
  31. }
  32. if (isset($_POST["id_user"])) {
  33. $user->modifyUser($_POST, $_POST["id_user"]);
  34. } else {
  35. $user->addUser($_POST);
  36. }
  37. } else {
  38. if ($isEdition) {
  39. $register = $user->getUserByID($userId);
  40. } ?>
  41. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  42. <html xmlns="http://www.w3.org/1999/xhtml">
  43. <head>
  44. <title>gelato :: <?php echo __("add user")?></title>
  45. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  46. <meta name="generator" content="gelato cms <?php echo util::version(); ?>" />
  47. <link rel="shortcut icon" href="<?php echo $conf->urlGelato; ?>/images/favicon.ico" />
  48. <script language="javascript" type="text/javascript" src="<?php echo $conf->urlGelato; ?>/admin/scripts/jquery.js"></script>
  49. <script language="javascript" type="text/javascript" src="<?php echo $conf->urlGelato; ?>/admin/scripts/tools.js"></script>
  50. <style type="text/css" media="screen">
  51. @import "<?php echo $conf->urlGelato; ?>/admin/css/style.css";
  52. </style>
  53. </head>
  54. <body>
  55. <div id="div-process" style="display:none;"><?php echo __("Processing request&hellip;"); ?></div>
  56. <div id="cont">
  57. <div id="head">
  58. <h1><a href="<?php echo $conf->urlGelato; ?>/admin/index.php" title="gelato :: <?php echo __("home")?>">gelato cms</a></h1>
  59. <ul id="nav">
  60. <li><a href="<?php echo $conf->urlGelato; ?>/" title="<?php echo __("Take me to the tumblelog")?>"><?php echo __("Back to the Tumblelog")?></a></li>
  61. </ul>
  62. </div>
  63. <div id="main">
  64. <div class="box">
  65. <ul class="menu manage">
  66. <h3><?php echo __("Start session")?></h3>
  67. <li><a href="index.php"><?php echo __("Post")?></a></li>
  68. <li><a href="admin.php"><?php echo __("Users")?></a></li>
  69. <li class="selected"><a><?php echo ($isEdition) ? __("Edit") : __("Add"); ?></a></li>
  70. </ul>
  71. <div class="tabla">
  72. <form action="user.php" method="post" onSubmit="return validateFrmAddUser();" name="frm_add" class="newpost">
  73. <fieldset>
  74. <ul>
  75. <?php
  76. if ($isEdition) {
  77. ?>
  78. <input type="hidden" name="id_user" id="id_user" value="<?php echo $userId; ?>" />
  79. <?php
  80. } ?>
  81. <li>
  82. <label for="login"><?php echo __("user:")?></label>
  83. <input class="txt" name="login" id="login" type="text" autocomplete="off" value="<?php echo isset($register["login"])?$register["login"]:""; ?>" />
  84. <?php
  85. if (!$isEdition) {
  86. ?>
  87. <br /><input class='submit_normal_azul' name='btnVerifyUser' id='btnVerifyUser' type='button' value='Check availability' onclick='verifyExistingUser()' />
  88. <?php
  89. } ?>
  90. </li>
  91. <li>
  92. <div id="target" style="display:none;"></div>
  93. </li>
  94. <li>
  95. <label for="pass"><?php echo __("password:")?></label>
  96. <input class="txt" name="password" id="password" type="password" />
  97. </li>
  98. <li>
  99. <label for="repass"><?php echo __("retype password:")?></label>
  100. <input class="txt" name="repass" id="repass" type="password" />
  101. </li>
  102. <li>
  103. <label for="name"><?php echo __("name:")?></label>
  104. <input class="txt" name="name" id="name" type="text" value="<?php echo isset($register["name"])?$register["name"]:""; ?>" />
  105. </li>
  106. <li>
  107. <label for="email"><?php echo __("e-mail:")?></label>
  108. <input class="txt" name="email" id="email" type="text" value="<?php echo isset($register["email"])?$register["email"]:""; ?>" />
  109. </li>
  110. <li>
  111. <label for="website"><?php echo __("website:")?></label>
  112. <input class="txt" name="website" id="website" type="text" value="<?php echo isset($register["website"])?$register["website"]:""; ?>" />
  113. </li>
  114. <li>
  115. <label for="about"><?php echo __("about:")?></label><br />
  116. <textarea rows="5" cols="50" name="about" id="about" tabindex="7"><?php echo isset($register["about"])?$register["about"]:""; ?></textarea>
  117. </li>
  118. <li>
  119. <input name="btnAdd" type="submit" value="<?php echo ($isEdition) ? __("Modify") : __("Add"); ?> user" />
  120. </li>
  121. </ul>
  122. </fieldset>
  123. </form>
  124. </div>
  125. <div class="footer-box">&nbsp;</div>
  126. </div>
  127. </div>
  128. <div id="foot">
  129. <a href="http://www.gelatocms.com/" title="gelato CMS">gelato CMS</a> :: PHP/MySQL Tumblelog Content Management System.
  130. </div>
  131. </div>
  132. </body>
  133. </html>
  134. <?php
  135. }
  136. } else {
  137. header("Location: ".$conf->urlGelato."/login.php");
  138. }
  139. ?>