A tumblelog CMS built on AJAX, PHP and MySQL.

user.php 5.5KB

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