PageRenderTime 23ms CodeModel.GetById 33ms RepoModel.GetById 0ms app.codeStats 0ms

/templates/identica/admin_edituser.php

https://github.com/leviself/Feedmailer
PHP | 152 lines | 142 code | 8 blank | 2 comment | 2 complexity | f540d9eab5799f3bf47357aca9faec20 MD5 | raw file
  1. <?php // Load the templates class
  2. $template = new templates();
  3. include dirname(__FILE__)."/functions.php";
  4. // Load the mysql class
  5. $mysql = new db();
  6. $mysql->connect();
  7. // Settings page, if user is loaded.
  8. $input = $_GET[id];
  9. $userid = @mysql_result(mysql_query(
  10. "SELECT `id` FROM `{$mysql->prefix}users`
  11. WHERE email='$input' OR username='$input'
  12. OR id='$input'"),0);
  13. if ($input){
  14. if (!$userid){
  15. die($template->error("User does not exist.").$template->footer());
  16. }
  17. $user = $mysql->selectUser($userid);
  18. ?>
  19. <?php admin_pagenav("Users"); ?>
  20. <?php // Load the sidebar
  21. $template->sidebar();
  22. ?>
  23. <form action="<?php echo $_SERVER[PHP_SELF];?>" method="post">
  24. <div id="sidebar_page">
  25. <div id="boxpadding">
  26. <br />
  27. <table id="form_data">
  28. <tr>
  29. <td><strong>Change Username</strong></td>
  30. <td><input type="text" name="username" value="<?php echo $user[username];?>" class="inputbox" /></td>
  31. <tr>
  32. <td></td>
  33. <td>
  34. <p class="form_help">
  35. The user's system username.
  36. </p>
  37. </td>
  38. </tr>
  39. </tr>
  40. <tr>
  41. <td><strong>Change Password</strong></td>
  42. <td><input type="password" name="password" value="" class="inputbox" /></td>
  43. <tr>
  44. <td></td>
  45. <td>
  46. <p class="form_help">
  47. Leave blank if you do not wish to change it.
  48. </p>
  49. </td>
  50. </tr>
  51. </tr>
  52. <tr>
  53. <td><strong>Change Email Address</strong></td>
  54. <td><input type="text" name="email" value="<?php echo $user[email];?>" class="inputbox" /></td>
  55. <tr>
  56. <td></td>
  57. <td>
  58. <p class="form_help">
  59. The email address that receives updates.
  60. </p>
  61. </td>
  62. </tr>
  63. </tr>
  64. <tr>
  65. <td><strong>Cookie Expire Time</strong></td>
  66. <td><input type="text" name="cookie_expire" value="<?php echo $user[cookie_expire];?>" class="inputbox" /></td>
  67. <tr>
  68. <td></td>
  69. <td>
  70. <p class="form_help">
  71. Specified in seconds.
  72. </p>
  73. </td>
  74. </tr>
  75. </tr>
  76. <tr>
  77. <td><strong>Registered IP</strong></td>
  78. <td><input type="text" readonly="readonly" value="<?php echo $user[reg_ip];?>" class="inputbox" /></td>
  79. </tr>
  80. <tr>
  81. <td><strong>Email Count</strong></td>
  82. <td><input type="text" readonly="readonly" value="<?php echo $user[email_count];?>" class="inputbox" /></td>
  83. </tr>
  84. <tr>
  85. <td><strong>Mail Type</strong>
  86. <td>
  87. <select name="mail_type" class="inputbox">
  88. <option value="text/plain" <?php if($user[mail_type] == "text/plain"){ echo 'selected="selected" ';}?>>text/plain</option>
  89. <option value="text/html" <?php if($user[mail_type] == "text/html"){ echo 'selected="selected" ';}?>>text/html</option>
  90. <option value="multipart/alternative" <?php if($user[mail_type] == "multipart/alternative"){ echo 'selected="selected" ';}?>>multipart/alternative</option>
  91. </select>
  92. </td>
  93. </tr>
  94. </table>
  95. <p>
  96. <h3>Options</h3>
  97. <input type="checkbox" name="is_admin" value="true" <?php if($user[is_admin] == "true"){echo 'checked="checked" ';}?> /> Administrator<br />
  98. <input type="checkbox" name="vacation" value="on" <?php if($user[vacation] == "on"){echo 'checked="checked" ';}?> /> Set Vacation
  99. </p>
  100. <p>
  101. <input type="hidden" name="userid" value="<?php echo $userid;?>" />
  102. <input type="submit" class="submit" value="Update" />
  103. </p>
  104. </div>
  105. </div>
  106. </form>
  107. <?php
  108. } // Display the main edit page (inputting user)
  109. else {
  110. ?>
  111. <?php admin_pagenav("Users"); ?>
  112. <?php // Load the sidebar
  113. $template->sidebar();
  114. ?>
  115. <form action="<?php echo $_SERVER[PHP_SELF];?>" method="get">
  116. <div id="sidebar_page">
  117. <div id="boxpadding">
  118. <br />
  119. <table id="form_data">
  120. <tr>
  121. <td><strong>User</strong></td>
  122. <td><input type="text" name="id" value="" class="inputbox" /></td>
  123. <tr>
  124. <td></td>
  125. <td>
  126. <p class="form_help">
  127. UserID, Username or Email Address.
  128. </p>
  129. </td>
  130. </tr>
  131. </tr>
  132. </table>
  133. <p>
  134. <input type="submit" class="submit" value="Edit User" />
  135. </p>
  136. </div>
  137. </div>
  138. </form>
  139. <?php // end it
  140. }
  141. ?>