A tumblelog CMS built on AJAX, PHP and MySQL.

user.php 5.2KB

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