PageRenderTime 44ms CodeModel.GetById 32ms RepoModel.GetById 0ms app.codeStats 2ms

/forum/toolkit.php

https://bitbucket.org/publicwhip/publicwhip-v1
PHP | 9557 lines | 4487 code | 4340 blank | 730 comment | 973 complexity | b98b336b5cbd297f796aac673ee913d7 MD5 | raw file
Possible License(s): AGPL-1.0, BSD-3-Clause
  1. <?php
  2. // PHPBB Admin ToolKit, v2.1b - Starfoxtj (starfoxtj@yahoo.com)
  3. // Copyright 2007 - Starfoxtj
  4. // This script is NOT released under the GPL:
  5. /*****************************************************************************************************
  6. By using this script you agree to the following:
  7. 1. You may modify any portion of this script for personal/business use. This includes changing the
  8. look, style, messages, functions, behavior etc. Note that any modifications outside of the standard
  9. configuration options may negatively affect the security of this script if the modification is not
  10. written properly and securely.
  11. Note: If the script has been modified, I ask that you at least retain the toolkit name, and
  12. my name (Starfoxtj), as a link to: http://starfoxtj.no-ip.com/phpbb/uploadtoolkit on the header
  13. or footer of every page. You are not required to list this information, but by removing it you may
  14. be forfeiting your support for this product. (Similar to the phpbb copyright agreement)
  15. 2. Ownership of this script remains with Starfoxtj regardless of how this script was acquired.
  16. 3. You may NOT sell any portion of this script, even if it is contained within another package
  17. without prior consent from Starfoxtj.
  18. 4. You may NOT hold Starfoxtj liable for any direct or indirect consequences of using this script.
  19. Many hours have been spent ensuring that this script is as secure as possible. However nothing
  20. can be 100% guaranteed.
  21. If a security hole has been found, please contact me immediately at: starfoxtj@yahoo.com
  22. 5. You MAY distribute this script stand alone, or with another package without any prior permission
  23. at no charge. You may NOT however, distribute this script if any modifications have been made
  24. without the consent of Starfoxtj. Meaning, only the unmodified original may be freely distributed
  25. (at no charge).
  26. I personally recommended you only download this script from:
  27. http://starfoxtj.no-ip.com/phpbb/toolkit
  28. If the script was downloaded form another location, it IS possible that it may have been altered.
  29. ******************************************************************************************************/
  30. // You may set a password here if you would rather not use the toolkit_config.php
  31. $use_toolkit_config_file = 'yes'; // Change this to 'No' to set the password in the toolkit.php itself like in previous releases
  32. $use_hashed_in_file_passwords = 'no'; // Change this if you want to use hashed admin/mod passwords specified in the toolkit (the toolkit_config.php file will use hashed passwords regardless)
  33. $adminpassword = 'ENTER_ADMIN_PASSWORD_HERE'; // Note: I HIGHLY recommend using a password at least 16 characters long!
  34. $modpassword = 'ENTER_MOD_PASSWORD_HERE'; // Leave blank to disable mod login
  35. // Option 1: Allow Mods to Ban/UnBan Users?
  36. $modban = 'yes'; // 'yes' : 'no'
  37. // Option 2: Allow Mods to Change User Post Count?
  38. $modpost = 'no'; // 'yes' : 'no'
  39. // Option 3: Allow Mods to Change User Ranks?
  40. $modrank = 'yes'; // 'yes' : 'no'
  41. // Option 4: Allow Mods to Delete Users?
  42. $moddelete = 'no'; // 'yes' : 'no'
  43. // Option 5: Update check URLs
  44. // Note: To disable checking for updates for phpbb, set the phpbb URL to 'none'
  45. // Note: To disable checking for updates for this toolkit, set the toolkit URL to 'none'
  46. // The default phpbb url is: http://www.phpbb.com/updatecheck/20x.txt
  47. // The default toolkit url is: http://starfoxtj.no-ip.com/phpBB/toolkit/updatecheck/2.x.txt
  48. $update_url['phpbb'] = 'http://www.phpbb.com/updatecheck/20x.txt';
  49. $update_url['toolkit'] = 'http://starfoxtj.no-ip.com/phpBB/toolkit/updatecheck/2.x.txt';
  50. // Lets begin the coding!
  51. //
  52. // (CHANGE INFORMATION AFTER THIS LINE WITH CAUTION!)
  53. //
  54. //
  55. //
  56. session_start();
  57. $_SESSION['toolkitversion'] = '2.1b';
  58. $_SESSION['toolkit_title'] = '<b><a href="index.php"><font size="5" color="#000000">PHPBB Admin ToolKit '.$_SESSION['toolkitversion'].'</b></font></a><font size="5"> - <a href="http://starfoxtj.no-ip.com/phpbb/toolkit" target="_blank">Starfoxtj</a></font>';
  59. $_SESSION['toolkit_title_nversion'] = '<b><a href="index.php"><font size="5" color="#000000">PHPBB Admin ToolKit</b></font></a><font size="5"> - <a href="http://starfoxtj.no-ip.com/phpbb/toolkit" target="_blank">Starfoxtj</a></font>';
  60. $_SESSION['copyrightfooter'] = '<br /><center><hr width="90%"><font size="2">PHPBB Admin ToolKit '.$_SESSION['toolkitversion'].' Š 2007 - <a href="mailto:starfoxtj@yahoo.com">Starfoxtj</a></font></center>';
  61. $phpbb_root_path = './';
  62. // Set global information and start db access
  63. if( file_exists( 'config.php' ) )
  64. {
  65. include( 'config.php' );
  66. if( $dbms == 'mysql' || $dbms == 'mysql4' )
  67. {
  68. $db = @mysql_connect("$dbhost", "$dbuser", "$dbpasswd")
  69. or die( 'Could not connect to database: '.mysql_error() );
  70. @mysql_select_db($dbname)
  71. or die( 'Could not select database: '.mysql_error() );
  72. }
  73. else
  74. {
  75. die( 'This toolkit is only compatible with MySQL databases.' );
  76. }
  77. }
  78. // Define Some Variables
  79. $index = $_SERVER['PHP_SELF'];
  80. $domain = $_SERVER['SERVER_NAME'];
  81. $full_domain = 'http://'.$domain;
  82. if( file_exists( 'config.php' ) )
  83. {
  84. $phpbb_auth_access = $table_prefix."auth_access";
  85. $phpbb_config = $table_prefix."config";
  86. $phpbb_banlist = $table_prefix."banlist";
  87. $phpbb_users = $table_prefix."users";
  88. $phpbb_ranks = $table_prefix."ranks";
  89. $phpbb_vote_voters = $table_prefix."vote_voters";
  90. $phpbb_user_group = $table_prefix."user_group";
  91. $phpbb_groups = $table_prefix."groups";
  92. $phpbb_posts = $table_prefix."posts";
  93. $phpbb_posts_text = $table_prefix."posts_text";
  94. $phpbb_topics = $table_prefix."topics";
  95. $phpbb_forums = $table_prefix."forums";
  96. $phpbb_themes = $table_prefix."themes";
  97. $phpbb_themes_name = $table_prefix."themes_name";
  98. $phpbb_sessions = $table_prefix."sessions";
  99. $phpbb_sessions_keys = $table_prefix."sessions_keys";
  100. $phpbb_topics_watch = $table_prefix."topics_watch";
  101. $phpbb_privmsgs = $table_prefix."privmsgs";
  102. $phpbb_privmsgs_text = $table_prefix."privmsgs_text";
  103. $phpbb_version_result = mysql_query("SELECT * FROM $phpbb_config WHERE config_name='version'")
  104. or die( 'MySQL Error: '.mysql_error() );
  105. $myrow_phpbb_version = mysql_fetch_array($phpbb_version_result);
  106. $phpbb_version = $myrow_phpbb_version['config_value'];
  107. }
  108. $script_folder = substr( $index, 1, -(strlen( end( explode( '/', $index ) ) ) + 1 ) );
  109. // Set the errors to only display one of each error
  110. if( isset( $_SESSION['errors']['index'] ) )
  111. {
  112. $_SESSION['errors']['index'] = array_unique( $_SESSION['errors']['index'] );
  113. }
  114. if( isset( $_SESSION['errors']['edituser'] ) )
  115. {
  116. $_SESSION['errors']['edituser'] = array_unique( $_SESSION['errors']['edituser'] );
  117. }
  118. if( isset( $_SESSION['errors']['config'] ) )
  119. {
  120. $_SESSION['errors']['config'] = array_unique( $_SESSION['errors']['config'] );
  121. }
  122. /////////////////////////////////////////
  123. //
  124. // Check and Create config.php
  125. //
  126. if( !file_exists( 'config.php' ) )
  127. { //-.2-a
  128. if( isset( $_POST['configphp_setup'] ) )
  129. { //-.1-a.1
  130. if( $_POST['dbhost'] == '' ||
  131. $_POST['dbuser'] == '' ||
  132. $_POST['dbpasswd'] == '' ||
  133. $_POST['dbname'] == '' )
  134. {
  135. $_SESSION['configphp_error'] = '<b>Error:</b> All fields must be filled in.';
  136. header( "Location: $index" );
  137. die();
  138. }
  139. @chmod( "../$script_folder", 0777 )
  140. or die( "Could not CHMOD $script_folder folder to create config.php!<br />
  141. You can either change the CHMOD settings manually to 777, or create the config.php file by copying the following information
  142. into notepad and specifying the database settings. Then save it as \"config.php\" and upload it to your $script_folder folder.<br /><br />
  143. Note: This assumes you are using MySQL4, if you are using MySQL3, replace \"mysql4\" with \"mysql\".<br /><br />
  144. <table border=\"0\" width=\"400\" cellpadding=\"5\"; style=\"border-top: black 1px solid; border-right: black 1px solid; border-left: black 1px solid; border-bottom: black 1px solid\" bgcolor=\"#f5f5f5\">
  145. <tr>
  146. <td>
  147. <b>&lt;?php<br /><br />
  148. // phpBB 2.x auto-generated config file<br />
  149. // Do not change anything in this file!<br /><br />
  150. \$dbms = 'mysql4';<br /><br />
  151. \$dbhost = '<font color=\"#ff0000\">Your Host</font>';<br />
  152. \$dbname = '<font color=\"#ff0000\">Your Database Name</font>';<br />
  153. \$dbuser = '<font color=\"#ff0000\">Your Username</font>';<br />
  154. \$dbpasswd = '<font color=\"#ff0000\">Your Password</font>';<br /><br />
  155. \$table_prefix = 'phpbb_';<br /><br />
  156. define('PHPBB_INSTALLED', true);<br /><br />
  157. ?&gt;</b>
  158. </td>
  159. </tr>
  160. </table>" );
  161. @touch( 'config.php' )
  162. or die( "Could not create config.php!<br />
  163. You can either change the CHMOD settings manually to 777, or create the config.php file by copying the following information
  164. into notepad and specifying the database settings. Then save it as \"config.php\" and upload it to your $script_folder folder.<br /><br />
  165. Note: This assumes you are using MySQL4, if you are using MySQL3, replace \"mysql4\" with \"mysql\".<br /><br />
  166. <table border=\"0\" width=\"400\" cellpadding=\"5\"; style=\"border-top: black 1px solid; border-right: black 1px solid; border-left: black 1px solid; border-bottom: black 1px solid\" bgcolor=\"#f5f5f5\">
  167. <tr>
  168. <td>
  169. <b>&lt;?php<br /><br />
  170. // phpBB 2.x auto-generated config file<br />
  171. // Do not change anything in this file!<br /><br />
  172. \$dbms = 'mysql4';<br /><br />
  173. \$dbhost = '<font color=\"#ff0000\">Your Host</font>';<br />
  174. \$dbname = '<font color=\"#ff0000\">Your Database Name</font>';<br />
  175. \$dbuser = '<font color=\"#ff0000\">Your Username</font>';<br />
  176. \$dbpasswd = '<font color=\"#ff0000\">Your Password</font>';<br /><br />
  177. \$table_prefix = 'phpbb_';<br /><br />
  178. define('PHPBB_INSTALLED', true);<br /><br />
  179. ?&gt;</b>
  180. </td>
  181. </tr>
  182. </table>" );
  183. $fp = fopen( 'config.php', "w" )
  184. or die ("The file config.php exists but could not be opened. Check the file permissions." );
  185. $dbms = $_POST['dbms'];
  186. $dbhost = $_POST['dbhost'];
  187. $dbuser = $_POST['dbuser'];
  188. $dbpasswd = $_POST['dbpasswd'];
  189. $dbname = $_POST['dbname'];
  190. $table_prefix = $_POST['table_prefix'];
  191. fwrite( $fp, "<?php
  192. // phpBB 2.x auto-generated config file
  193. // Do not change anything in this file!
  194. \$dbms = '$dbms';
  195. \$dbhost = '$dbhost';
  196. \$dbname = '$dbname';
  197. \$dbuser = '$dbuser';
  198. \$dbpasswd = '$dbpasswd';
  199. \$table_prefix = '$table_prefix';
  200. define('PHPBB_INSTALLED', true);
  201. ?>" );
  202. fclose( $fp );
  203. chmod( "../$script_folder", 0755 );
  204. header( "Location: $index" );
  205. die();
  206. } //-.1-a.1
  207. else
  208. { //-.1-a.2
  209. session_destroy();
  210. ?>
  211. <html>
  212. <head>
  213. <title>PHPBB Admin ToolKit v<?php echo $_SESSION['toolkitversion']; ?></title>
  214. <SCRIPT LANGUAGE="JavaScript">
  215. function placeFocus() {
  216. if (document.forms.length > 0) {
  217. var field = document.forms[0];
  218. for (i = 1; i < field.length; i++) {
  219. if ((field.elements[i].name == "dbhost") || (field.elements[i].type == "textarea") || (field.elements[i].type.toString().charAt(0) == "s")) {
  220. document.forms[0].elements[i].focus();
  221. break;
  222. }
  223. }
  224. }
  225. }
  226. </script>
  227. </head>
  228. <body link="#0000ff" vlink="#0000ff" alink="#0000ff" OnLoad="placeFocus()">
  229. <center>
  230. <table border="0" bgcolor="#ffffff" cellspacing="1" cellpadding="3">
  231. <tr><td><div align="center"><?php echo $_SESSION['toolkit_title']; ?></div></td></tr>
  232. </table><br />
  233. </center>
  234. <center>
  235. <font size="4">PHPBB Admin ToolKit: Create Config.php file</font>
  236. <br /><br />
  237. Config.php file not found! You may create a new one by entering in the information below:<br /><br />
  238. <table border="0" bgcolor="#ffffff" cellspacing="1" cellpadding="3">
  239. <tr>
  240. <td>
  241. <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="POST">
  242. <table border="0" cellpadding="5" cellspacing="0">
  243. <tr>
  244. <td>
  245. Database Type:
  246. </td>
  247. <td>
  248. <select name="dbms">
  249. <option value="mysql">MySQL 3.x</option>
  250. <option value="mysql4" selected>MySQL 4.x</option>
  251. <option value="postgres">PostgreSQL 7.x</option>
  252. <option value="mssql">MS SQL Server 7/2000</option>
  253. <option value="msaccess">MS Access [ ODBC ]</option>
  254. <option value="mssql-odbc">MS SQL Server [ ODBC ]</option></select>
  255. </td>
  256. </tr>
  257. <tr>
  258. <td>
  259. Host:
  260. </td>
  261. <td>
  262. <input type="text" name="dbhost" lengh="20" size="20" maxlengh="255">
  263. </td>
  264. </tr>
  265. <tr>
  266. <td>
  267. Username:
  268. </td>
  269. <td>
  270. <input type="text" name="dbuser" lengh="20" size="20" maxlengh="255">
  271. </td>
  272. </tr>
  273. <tr>
  274. <td>
  275. Password:
  276. </td>
  277. <td>
  278. <input type="password" name="dbpasswd" lengh="20" size="20" maxlengh="255">
  279. </td>
  280. </tr>
  281. <tr>
  282. <td>
  283. Database:
  284. </td>
  285. <td>
  286. <input type="text" name="dbname" lengh="20" size="20" maxlengh="255">
  287. </td>
  288. </tr>
  289. <tr>
  290. <td>
  291. Table Prefix:
  292. </td>
  293. <td>
  294. <input type="text" name="table_prefix" value="phpbb_" lengh="20" size="20" maxlengh="255">
  295. </td>
  296. </tr>
  297. <tr>
  298. <td colspan="2" align="center">
  299. <input type="hidden" name="configphp_setup" value="1" />
  300. <br /><input TYPE="submit" VALUE="Create Config.php">
  301. </td>
  302. </tr>
  303. </table>
  304. </form>
  305. </td>
  306. </tr>
  307. </table>
  308. </center>
  309. <?php
  310. if( isset( $_SESSION['configphp_error'] ) )
  311. {
  312. ?>
  313. <center>
  314. <table border="0" bgcolor="#ffffff" cellspacing="1" cellpadding="3">
  315. <tr>
  316. <td>
  317. <br /><br /><?php echo $_SESSION['configphp_error']; ?>
  318. </td>
  319. </tr>
  320. </table>
  321. <?php
  322. }
  323. ?>
  324. </body>
  325. </html>
  326. <?php
  327. } //-.1-a.2
  328. die();
  329. } //-.2-a
  330. /////////////////////////////////////////
  331. //
  332. // Check and set fist time password
  333. //
  334. if( !file_exists( 'toolkit_config.php' ) && $use_toolkit_config_file == 'yes' )
  335. { //-.1-a
  336. if( isset( $_POST['toolkitconfig_setup'] ) )
  337. { //-.1-a.1
  338. if( !isset( $_POST['admin_password'] ) || !isset( $_POST['admin_password_confirm'] ) )
  339. {
  340. $_SESSION['toolkitconfig_error'] = '<b>Error:</b> Either the admin password was not specified, or the passwords did not match.';
  341. header( "Location: $index" );
  342. die();
  343. }
  344. elseif( $_POST['admin_password'] == '' || $_POST['admin_password_confirm'] == '' )
  345. {
  346. $_SESSION['toolkitconfig_error'] = '<b>Error:</b> Either the admin password was not specified, or the passwords did not match.';
  347. header( "Location: $index" );
  348. die();
  349. }
  350. elseif( $_POST['admin_password'] != $_POST['admin_password_confirm'] )
  351. {
  352. $_SESSION['toolkitconfig_error'] = '<b>Error:</b> The admin passwords do not match.';
  353. header( "Location: $index" );
  354. die();
  355. }
  356. if( $_POST['mod_password'] != $_POST['mod_password_confirm'] )
  357. {
  358. $_SESSION['toolkitconfig_error'] = '<b>Error:</b> The mod passwords do not match.';
  359. header( "Location: $index" );
  360. die();
  361. }
  362. @chmod( "../$script_folder", 0777 )
  363. or die( "Could not CHMOD $script_folder to 777 to create toolkit_config.php!<br />
  364. 1: Extract the toolkit.php file and open it with notepad.<br />
  365. 2: Find \"\$use_toolkit_config_file\" on line 40.<br />
  366. 3: Change the 'yes' to 'no'.<br />
  367. 4: Replace both the admin and mod passwords on lines 41 and 42<br />
  368. 5: Upload toolkit.php to your $script_folder folder." );
  369. @touch( 'toolkit_config.php' )
  370. or die( "Could not create toolkit_config.php, access denied!<br />
  371. Please install this script using method 2:<br /><br />
  372. 1: Extract the toolkit.php file and open it with notepad.<br />
  373. 2: Find \"\$use_toolkit_config_file\" on line 40.<br />
  374. 3: Change the 'yes' to 'no'.<br />
  375. 4: Replace both the admin and mod passwords on lines 41 and 42<br />
  376. 5: Upload toolkit.php to your $script_folder folder." );
  377. $fp = fopen( 'toolkit_config.php', "w" )
  378. or die ("The file toolkit_config.php exists but could not be opened. Check the file permissions." );
  379. $version = $_SESSION['toolkitversion'];
  380. $adminpassword = md5( md5( $_POST['admin_password'] ) );
  381. $modpassword = md5( md5( $_POST['mod_password'] ) );
  382. fwrite( $fp, "<?php
  383. ////////////////////////////////////////////////////////////
  384. //
  385. // PHPBB Admin ToolKit v$version auto-generated config file.
  386. //
  387. // You may change the passwords in this file.
  388. // Note: The passwords in this file are hashed for security.
  389. // If you need to change your passwords, you can either use the MD5 Generator included
  390. // near the bottom of the toolkit index.
  391. // Or you can simply delete this toolkit_config.php file and run toolkit.php
  392. // to recreate this file with the new passwords.
  393. //
  394. // NOTE: For security, the passwords for this toolkit have been DOUBLE hashed!
  395. // Meaning, the password was hashed once using the md5() function, then the hash
  396. // was hashed again using the md5() function. The code equivalent is: \$pass = md5( md5( 'password' ) );
  397. // Because the password is double hashed, it should be almost completely uncrackable as
  398. // a brute force/dictionary attack would have to first crack a 32 character password, THEN
  399. // crack the result yielding the original password.
  400. // This way, even if someone got your toolkit.config.php file it would in theory
  401. // take the most powerful home computer over 10 years to break.
  402. //
  403. \$adminpassword = '$adminpassword';
  404. \$modpassword = '$modpassword';
  405. ?>" );
  406. fclose( $fp );
  407. chmod( "../$script_folder", 0755 );
  408. header( "Location: $index" );
  409. die();
  410. } //-.1-a.1
  411. else
  412. { //-.1-a.2
  413. session_destroy();
  414. ?>
  415. <html>
  416. <head>
  417. <title>PHPBB Admin ToolKit v<?php echo $_SESSION['toolkitversion']; ?></title>
  418. <SCRIPT LANGUAGE="JavaScript">
  419. function placeFocus() {
  420. if (document.forms.length > 0) {
  421. var field = document.forms[0];
  422. for (i = 0; i < field.length; i++) {
  423. if ((field.elements[i].name == "admin_password") || (field.elements[i].type == "textarea") || (field.elements[i].type.toString().charAt(0) == "s")) {
  424. document.forms[0].elements[i].focus();
  425. break;
  426. }
  427. }
  428. }
  429. }
  430. </script>
  431. </head>
  432. <body link="#0000ff" vlink="#0000ff" alink="#0000ff" OnLoad="placeFocus()">
  433. <center>
  434. <table border="0" bgcolor="#ffffff" cellspacing="1" cellpadding="3">
  435. <tr><td><div align="center"><?php echo $_SESSION['toolkit_title']; ?></div></td></tr>
  436. </table><br />
  437. </center>
  438. <center>
  439. <font size="4">PHPBB Admin ToolKit: First Time Setup</font><br />
  440. <table border="0" bgcolor="#ffffff" cellspacing="1" cellpadding="3">
  441. <tr>
  442. <td>
  443. <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="POST">
  444. <table border="0" cellpadding="5" cellspacing="0">
  445. <tr>
  446. <td>
  447. Specify Admin Password:
  448. </td>
  449. <td>
  450. <input type="password" name="admin_password" lengh="20" size="20" maxlengh="255">
  451. </td>
  452. </tr>
  453. <tr>
  454. <td>
  455. Confirm Admin Password:
  456. </td>
  457. <td>
  458. <input type="password" name="admin_password_confirm" lengh="20" size="20" maxlengh="255">
  459. </td>
  460. </tr>
  461. <tr>
  462. <td>
  463. <br />Specify ModPassword:
  464. </td>
  465. <td>
  466. <br /><input type="password" name="mod_password" lengh="20" size="20" maxlengh="255"> (Optional)
  467. </td>
  468. </tr>
  469. <tr>
  470. <td>
  471. Confirm Mod Password:
  472. </td>
  473. <td>
  474. <input type="password" name="mod_password_confirm" lengh="20" size="20" maxlengh="255"> (Optional)
  475. </td>
  476. </tr>
  477. <tr>
  478. <td colspan="2" align="center">
  479. <input type="hidden" name="toolkitconfig_setup" value=1 />
  480. <br /><input TYPE="submit" VALUE=" Enter ">
  481. </td>
  482. </tr>
  483. </table>
  484. </form>
  485. </td>
  486. </tr>
  487. </table>
  488. </center>
  489. <?php
  490. if( isset( $_SESSION['toolkitconfig_error'] ) )
  491. {
  492. ?>
  493. <center>
  494. <table border="0" bgcolor="#ffffff" cellspacing="1" cellpadding="3">
  495. <tr>
  496. <td>
  497. <br /><br /><?php echo $_SESSION['toolkitconfig_error']; ?>
  498. </td>
  499. </tr>
  500. </table>
  501. <?php
  502. }
  503. ?>
  504. </body>
  505. </html>
  506. <?php
  507. } //-.1-a.2
  508. die();
  509. } //-.1-a
  510. elseif( file_exists( 'toolkit_config.php' ) && $use_toolkit_config_file == 'yes' )
  511. {
  512. include( 'toolkit_config.php' );
  513. }
  514. if( !isset( $_SESSION['user_level'] ) )
  515. { //-.1
  516. $_SESSION['user_level'] = "null";
  517. } //-.1
  518. if( !isset( $_SESSION['AUTH'] ) )
  519. {
  520. $_SESSION['AUTH'] = array();
  521. }
  522. // Safe SQL data function
  523. function safe_sql( $data )
  524. {
  525. if ( get_magic_quotes_gpc() )
  526. {
  527. $data = stripslashes( $data );
  528. }
  529. if( phpversion() >= 4.3 )
  530. {
  531. $data = mysql_real_escape_string( $data );
  532. }
  533. else
  534. {
  535. $data = mysql_escape_string( $data );
  536. }
  537. $data = str_replace( '&', '&amp;', $data );
  538. $data = str_replace( '<', '&lt;', $data );
  539. $data = str_replace( '>', '&gt;', $data );
  540. return $data;
  541. }
  542. function safe_html( $data )
  543. {
  544. $data = trim( $data );
  545. $data = str_replace( '&', '&amp;', $data );
  546. $data = str_replace( '<', '&lt;', $data );
  547. $data = str_replace( '>', '&gt;', $data );
  548. return $data;
  549. }
  550. // Safe descriptions data function
  551. function safe_desc( $data )
  552. {
  553. $data = str_replace( '&', '&amp;', $data );
  554. $data = str_replace( '<', '&lt;', $data );
  555. $data = str_replace( '>', '&gt;', $data );
  556. return $data;
  557. }
  558. // make_time function
  559. function make_time( $time )
  560. {
  561. // Set error value to false as no errors are generated yet
  562. $error = false;
  563. // Set vals to proper "type" (int)
  564. $mm = intval( $time['mm'] );
  565. $dd = intval( $time['dd'] );
  566. $yy = intval( $time['yy'] );
  567. $time_hh = intval( $time['time_hh'] );
  568. $time_mm = intval( $time['time_mm'] );
  569. $time_ss = intval( $time['time_ss'] );
  570. // Pad vals with leading zeros if single digets
  571. $mm = sprintf( "%02d", $mm );
  572. $dd = sprintf( "%02d", $dd );
  573. $yy = sprintf( "%02d", $yy );
  574. $time_hh = sprintf( "%02d", $time_hh );
  575. $time_mm = sprintf( "%02d", $time_mm );
  576. $time_ss = sprintf( "%02d", $time_ss );
  577. $time_ap = $time['time_ap'];
  578. // First check if specified date is a correct one
  579. if( !checkdate( $mm, $dd, $yy ) )
  580. {
  581. $_SESSION['errors']['make_time'][] = 'You have entered an invalid date combination.';
  582. $error = true;
  583. return false;
  584. }
  585. // Check if year is after 1970 (because thats when the timestamp starts)
  586. if( $yy < 1970 )
  587. {
  588. $_SESSION['errors']['make_time'][] = 'Due to the Unix timestamp restriction, the year must not be before 1970.';
  589. $error = true;
  590. return false;
  591. }
  592. // Now perform various checks on the time info
  593. if(
  594. (
  595. $time_hh > 12 ||
  596. $time_hh < 1 ||
  597. $time_mm > 60 ||
  598. $time_ss < 0 ||
  599. $time_ss > 60 ||
  600. $time_mm < 0
  601. )
  602. ||
  603. (
  604. $time_ap != 'pm' &&
  605. $time_ap != 'am'
  606. ) )
  607. {
  608. $_SESSION['errors']['make_time'][] = 'You have entered an invalid time.';
  609. $error = true;
  610. return false;
  611. }
  612. // Generate timestamp
  613. if( $time_ap == 'pm' )
  614. {
  615. $time_hh += 12;
  616. }
  617. if( $error == false )
  618. {
  619. $time = mktime( $time_hh, $time_mm, $time_ss, $mm, $dd, $yy );
  620. return $time;
  621. }
  622. }
  623. // Delete user core function
  624. // Only the actual sql queries are here, the checks and options are in the delete_user() function
  625. function delete_user_core( $user_id, $clear_posts = false, $retain_pms = false )
  626. {
  627. // Set global variables
  628. global $index;
  629. global $phpbb_version;
  630. global $phpbb_banlist;
  631. global $phpbb_user_group;
  632. global $phpbb_users;
  633. global $phpbb_groups;
  634. global $phpbb_posts;
  635. global $phpbb_posts_text;
  636. global $phpbb_topics;
  637. global $phpbb_vote_voters;
  638. global $phpbb_auth_access;
  639. global $phpbb_sessions;
  640. global $phpbb_sessions_keys;
  641. global $phpbb_privmsgs;
  642. global $phpbb_privmsgs_text;
  643. global $phpbb_topics_watch;
  644. // First things first, sanitize the $user_id
  645. $user_id = safe_sql( $user_id);
  646. //
  647. // Obtain username and level based on user_id
  648. //
  649. $sql = "SELECT * FROM $phpbb_users WHERE user_id=$user_id LIMIT 1";
  650. $result = mysql_query($sql);
  651. $myrow = mysql_fetch_array($result);
  652. $username = safe_sql( $myrow['username'] );
  653. $user_level = safe_sql( $myrow['user_level'] );
  654. // Obtain first admin account to set as group mod if deleted user is a group mod (step 5)
  655. $sql = "SELECT * FROM $phpbb_users WHERE user_level=1 ORDER BY user_id ASC LIMIT 1";
  656. $result = mysql_query($sql);
  657. $myrow = mysql_fetch_array($result);
  658. $admin_id= safe_sql( $myrow['user_id'] );
  659. // Debug info:
  660. // echo '<pre>';
  661. // echo gettype( $myrow );
  662. // die( $admin_id );
  663. // This actually starts the delete process
  664. // **************************************************************
  665. //
  666. // First sql query is to collect group information about the user
  667. //
  668. // **************************************************************
  669. $sql = "SELECT g.group_id FROM $phpbb_user_group ug, $phpbb_groups g WHERE ug.user_id = $user_id AND g.group_id = ug.group_id AND g.group_single_user = 1";
  670. $result = mysql_query($sql);
  671. $row = mysql_fetch_array($result);
  672. unset( $row[0] ); // Read note directly below about this line:
  673. // PHPBB's $row = $db->sql_fetchrow($result); line returns an array containg the user id:
  674. // Array
  675. // (
  676. // [group_id] => 123
  677. // )
  678. // The mqsql fetch array used in this scrip: $myrow = mysql_fetch_array($result);
  679. // Returns the following:
  680. // Array
  681. // (
  682. // [0] => 123
  683. // [group_id] => 123
  684. // )
  685. // Therefore I unset the $row[0] element
  686. // Debugging info:
  687. // echo '<pre>';
  688. // print_r( $row );
  689. // echo"\n\n$username";
  690. // die();
  691. // ***************************************************************************
  692. //
  693. // Second sql query sets the poster id to the anonymous account for all posts
  694. // First query in this section is for the $clear_posts variable
  695. //
  696. // ***************************************************************************
  697. //
  698. // This check fixes the:
  699. // Error deleting user's group from groups table:
  700. // Line: 1477
  701. // File: /toolkit.php
  702. // Query: DELETE FROM `phpbb_groups` WHERE `group_id`=
  703. // MySQL Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
  704. //
  705. // Error message that was appearing in v2.1a because the returned value of $row was not correct
  706. // Debug for numeric check
  707. /* echo '<pre>';
  708. var_dump( $row );
  709. $i = is_numeric( '2 3' );
  710. var_dump( $i );
  711. die(); */
  712. if( !is_numeric( $row['group_id'] ) )
  713. {
  714. echo '<font size="4"><b>An incorrect value has been returned for group_id in the \'phpbb_groups\' table:</b></font><br /><b>Line:</b> '.__LINE__.'<br /><b>File:</b> '.$_SERVER['PHP_SELF'].'<br /><b>User ID: </b>'.$user_id.'<br /><b>Username: </b>'.$username.'<br /><b>Details:</b> This value should be a purely numeric integer. The value returned by the database is:<br /><pre>';
  715. var_dump( $row );
  716. echo '</pre><br />Please contact Starfoxtj at <a href="http://starfoxtj.no-ip.com">http://starfoxtj.no-ip.com</a> and report this error.';
  717. echo '<br /><br /><b>Note: </b> The script has halted before any changes to the database were made for this specific user.<br />All other users that were deleted before <b>'.$username.'</b> were properly removed.';
  718. echo '<br /><br /><b>Full envoirment details:</b><br /><pre>';
  719. var_dump( get_defined_vars() );
  720. die();
  721. }
  722. // If clear posts is set to true, replace all posts made by user to "DELETED"
  723. if( $clear_posts == true )
  724. {
  725. $sql = "SELECT `post_id` FROM `$phpbb_posts` WHERE `poster_id`=$user_id";
  726. if( !$result = mysql_query( $sql ) )
  727. {
  728. die( '<font size="4"><b>Error selecting selecting posts to clear:</b></font><br /><b>Line:</b> '.__LINE__.'<br /><b>File:</b> '.$_SERVER['PHP_SELF']."<br /><b>Query:</b> $sql<br /><b>MySQL Error:</b> ".mysql_error() );
  729. }
  730. // Assings the results of the above query into an array
  731. while($myrow = mysql_fetch_array($result))
  732. {
  733. $marked_posts[] = $myrow['post_id'];
  734. }
  735. // Makes mark an empty array if the user has no PMs
  736. if( !isset( $marked_posts ) )
  737. {
  738. $marked_posts = array();
  739. }
  740. // First check to see if user has any posts, if not skip replacing the posts
  741. if( isset( $marked_posts ) && count( $marked_posts ) )
  742. {
  743. $marked_posts = implode( ',', $marked_posts );
  744. $sql = "UPDATE `$phpbb_posts_text` SET `post_text`='DELETED' WHERE `post_id` IN ( $marked_posts )";
  745. // echo '<pre>';
  746. // echo $sql;
  747. // echo '<br />';
  748. // print_r( $marked_posts );
  749. // die();
  750. if( !$result = mysql_query( $sql ) )
  751. {
  752. die( '<font size="4"><b>Error setting posts to DELETED:</b></font><br /><b>Line:</b> '.__LINE__.'<br /><b>File:</b> '.$_SERVER['PHP_SELF']."<br /><b>Query:</b> $sql<br /><b>MySQL Error:</b> ".mysql_error() );
  753. }
  754. }
  755. // Sets the poster id to the anonymous account for all posts and replaces the username with DELETED
  756. $sql = "UPDATE `$phpbb_posts` SET `poster_id`=-1, `post_username`='DELETED' WHERE `poster_id`=$user_id";
  757. if( !$result = mysql_query( $sql ) )
  758. {
  759. die( '<font size="4"><b>Error setting poster id to anonymous for deleted user:</b></font><br /><b>Line:</b> '.__LINE__.'<br /><b>File:</b> '.$_SERVER['PHP_SELF']."<br /><b>Query:</b> $sql<br /><b>MySQL Error:</b> ".mysql_error() );
  760. }
  761. }
  762. else
  763. {
  764. // Sets the poster id to the anonymous account for all posts, but retains the original username
  765. $sql = "UPDATE `$phpbb_posts` SET `poster_id`=-1, `post_username`='".str_replace( "\\'", "''", addslashes( $username ) )."' WHERE `poster_id`=$user_id";
  766. if( !$result = mysql_query( $sql ) )
  767. {
  768. die( '<font size="4"><b>Error setting poster id to anonymous for deleted user:</b></font><br /><b>Line:</b> '.__LINE__.'<br /><b>File:</b> '.$_SERVER['PHP_SELF']."<br /><b>Query:</b> $sql<br /><b>MySQL Error:</b> ".mysql_error() );
  769. }
  770. }
  771. // ***************************************************************************
  772. //
  773. // Third sql query sets the topic id to the anonymous account for all topics
  774. //
  775. // ***************************************************************************
  776. // If clear posts is set to true, replace all topics made by user to "DELETED"
  777. if( $clear_posts == true )
  778. {
  779. $sql = "UPDATE `$phpbb_topics` SET `topic_title`='DELETED' WHERE `topic_poster`=$user_id";
  780. if( !$result = mysql_query( $sql ) )
  781. {
  782. die( '<font size="4"><b>Error setting topics to DELETED:</b></font><br /><b>Line:</b> '.__LINE__.'<br /><b>File:</b> '.$_SERVER['PHP_SELF']."<br /><b>Query:</b> $sql<br /><b>MySQL Error:</b> ".mysql_error() );
  783. }
  784. // Sets the topic id to the anonymous account for all topics and replaces the username with DELETED
  785. $sql = "UPDATE `$phpbb_topics` SET `topic_poster`=-1 WHERE `topic_poster`=$user_id";
  786. if( !$result = mysql_query( $sql ) )
  787. {
  788. die( '<font size="4"><b>Error setting topic id poster to anonymous for deleted user:</b></font><br /><b>Line:</b> '.__LINE__.'<br /><b>File:</b> '.$_SERVER['PHP_SELF']."<br /><b>Query:</b> $sql<br /><b>MySQL Error:</b> ".mysql_error() );
  789. }
  790. }
  791. else
  792. {
  793. // Sets the poster id to the anonymous account for all posts, but retains the original username
  794. $sql = "UPDATE `$phpbb_topics` SET `topic_poster`=-1 WHERE `topic_poster`=$user_id";
  795. if( !$result = mysql_query( $sql ) )
  796. {
  797. die( '<font size="4"><b>Error setting topic id poster to anonymous for deleted user:</b></font><br /><b>Line:</b> '.__LINE__.'<br /><b>File:</b> '.$_SERVER['PHP_SELF']."<br /><b>Query:</b> $sql<br /><b>MySQL Error:</b> ".mysql_error() );
  798. }
  799. }
  800. // ***************************************************************************
  801. //
  802. // Fourth sql query sets the voter id to anonymous
  803. //
  804. // ***************************************************************************
  805. $sql = "UPDATE `$phpbb_vote_voters` SET `vote_user_id`=-1 WHERE `vote_user_id`=$user_id";
  806. if( !$result = mysql_query( $sql ) )
  807. {
  808. die( '<font size="4"><b>Error setting voter ID to anonymous:</b></font><br /><b>Line:</b> '.__LINE__.'<br /><b>File:</b> '.$_SERVER['PHP_SELF']."<br /><b>Query:</b> $sql<br /><b>MySQL Error:</b> ".mysql_error() );
  809. }
  810. // ***************************************************************************
  811. //
  812. // Fifth sql query collects the phpbb_groups info and assigns it to the
  813. // $group_mods array where the user is a moderator
  814. //
  815. // ***************************************************************************
  816. $sql = "SELECT `group_id` FROM `$phpbb_groups` WHERE `group_moderator`=$user_id";
  817. if( !$result = mysql_query( $sql ) )
  818. {
  819. die( '<font size="4"><b>Error selecting groups where user is a moderator:</b></font><br /><b>Line:</b> '.__LINE__.'<br /><b>File:</b> '.$_SERVER['PHP_SELF']."<br /><b>Query:</b> $sql<br /><b>MySQL Error:</b> ".mysql_error() );
  820. }
  821. // Assings the results of the above query into an array
  822. while($myrow = mysql_fetch_array($result))
  823. {
  824. $group_mod[] = $myrow['group_id'];
  825. }
  826. // Debugging info:
  827. // echo '<pre>';
  828. // print_r( $group_mod );
  829. // die();
  830. // If the user is a moderator for any groups, this query assigns the
  831. // new mod status to the oldest admin account
  832. if( isset( $group_mod ) && count( $group_mod ) )
  833. {
  834. //
  835. // Make SURE to insert a query here to check for the first admin account to associate as the new group moderator
  836. // after the deleted user is deleted!
  837. // Done
  838. // $admin_id = 3; //This is a temp static admin id that will be dymamic in the final release
  839. $update_mod_id = implode( ',', $group_mod );
  840. $sql = "UPDATE `$phpbb_groups` SET `group_moderator`=$admin_id WHERE `group_moderator` IN ( $update_mod_id )";
  841. // Debugging info:
  842. // echo '<pre>';
  843. // echo $sql;
  844. // die();
  845. if( !$result = mysql_query( $sql ) )
  846. {
  847. die( '<font size="4"><b>Error setting new group moderator to oldest admin:</b></font><br /><b>Line:</b> '.__LINE__.'<br /><b>File:</b> '.$_SERVER['PHP_SELF']."<br /><b>Query:</b> $sql<br /><b>MySQL Error:</b> ".mysql_error() );
  848. }
  849. }
  850. // ***************************************************************************
  851. //
  852. // Sixth sql query deletes the user from the phpbb_users table
  853. //
  854. // ***************************************************************************
  855. $sql = "DELETE FROM `$phpbb_users` WHERE `user_id`=$user_id";
  856. if( !$result = mysql_query( $sql ) )
  857. {
  858. die( '<font size="4"><b>Error deleting user from users table:</b></font><br /><b>Line:</b> '.__LINE__.'<br /><b>File:</b> '.$_SERVER['PHP_SELF']."<br /><b>Query:</b> $sql<br /><b>MySQL Error:</b> ".mysql_error() );
  859. }
  860. // ***************************************************************************
  861. //
  862. // Seventh sql query deletes the user from the phpbb_user_group table
  863. //
  864. // ***************************************************************************
  865. $sql = "DELETE FROM `$phpbb_user_group` WHERE `user_id`=$user_id";
  866. if( !$result = mysql_query( $sql ) )
  867. {
  868. die( '<font size="4"><b>Error deleting user from user_group table:</b></font><br /><b>Line:</b> '.__LINE__.'<br /><b>File:</b> '.$_SERVER['PHP_SELF']."<br /><b>Query:</b> $sql<br /><b>MySQL Error:</b> ".mysql_error() );
  869. }
  870. // ***************************************************************************
  871. //
  872. // Eighth sql query moved to the top to check and exit if error
  873. //
  874. // ***************************************************************************
  875. $sql = "DELETE FROM `$phpbb_groups` WHERE `group_id`=".$row['group_id'];
  876. if( !$result = mysql_query( $sql ) )
  877. {
  878. die( '<font size="4"><b>Error deleting user\'s group from groups table:</b></font><br /><b>Line:</b> '.__LINE__.'<br /><b>File:</b> '.$_SERVER['PHP_SELF']."<br /><b>Query:</b> $sql<br /><b>MySQL Error:</b> ".mysql_error() );
  879. }
  880. // ***************************************************************************
  881. //
  882. // Ninth sql query deletes the user from the phpbb_auth_access table
  883. //
  884. // ***************************************************************************
  885. $sql = "DELETE FROM `$phpbb_auth_access` WHERE `group_id`=".$row['group_id'];
  886. if( !$result = mysql_query( $sql ) )
  887. {
  888. die( '<font size="4"><b>Error deleting user from auth_access table:</b></font><br /><b>Line:</b> '.__LINE__.'<br /><b>File:</b> '.$_SERVER['PHP_SELF']."<br /><b>Query:</b> $sql<br /><b>MySQL Error:</b> ".mysql_error() );
  889. }
  890. // ***************************************************************************
  891. //
  892. // Tenth sql query deletes the user from the phpbb topics watch table
  893. //
  894. // ***************************************************************************
  895. $sql = "DELETE FROM `$phpbb_topics_watch` WHERE `user_id`=$user_id";
  896. if( !$result = mysql_query( $sql ) )
  897. {
  898. die( '<font size="4"><b>Error deleting user from topics_watch table:</b></font><br /><b>Line:</b> '.__LINE__.'<br /><b>File:</b> '.$_SERVER['PHP_SELF']."<br /><b>Query:</b> $sql<br /><b>MySQL Error:</b> ".mysql_error() );
  899. }
  900. // ***************************************************************************
  901. //
  902. // Eleventh sql query deletes the user from the banlist table
  903. //
  904. // ***************************************************************************
  905. $sql = "DELETE FROM `$phpbb_banlist` WHERE `ban_userid`=$user_id";
  906. if( !$result = mysql_query( $sql ) )
  907. {
  908. die( '<font size="4"><b>Error deleting user from the banlist table:</b></font><br /><b>Line:</b> '.__LINE__.'<br /><b>File:</b> '.$_SERVER['PHP_SELF']."<br /><b>Query:</b> $sql<br /><b>MySQL Error:</b> ".mysql_error() );
  909. }
  910. // ***************************************************************************
  911. //
  912. // Twelfth sql query deletes the user from the sessions table
  913. //
  914. // ***************************************************************************
  915. // This delete section was added in .19, so a check is done before using it incase
  916. // the admin is running an older version of phpbb
  917. if( $phpbb_version >= 0.19 )
  918. {
  919. $sql = "DELETE FROM `$phpbb_sessions` WHERE `session_user_id`=$user_id";
  920. if( !$result = mysql_query( $sql ) )
  921. {
  922. die( '<font size="4"><b>Error deleting user from the sessions table:</b></font><br /><b>Line:</b> '.__LINE__.'<br /><b>File:</b> '.$_SERVER['PHP_SELF']."<br /><b>Query:</b> $sql<br /><b>MySQL Error:</b> ".mysql_error() );
  923. }
  924. }
  925. // ***************************************************************************
  926. //
  927. // Twelfth sql query deletes the user from the sessions_keys table
  928. //
  929. // ***************************************************************************
  930. // This delete section was added in .19, so a check is done before using it incase
  931. // the admin is running an older version of phpbb
  932. if( $phpbb_version >= '.0.19' )
  933. {
  934. // First check if the sesssions keys table exists
  935. // (Since alot of .19 boards dont have it due to incomplete updates
  936. $sql_key_check ="SHOW TABLES LIKE '$phpbb_sessions_keys'";
  937. if( !$result_key_check = mysql_query( $sql_key_check ) )
  938. {
  939. die( '<font size="4"><b>Error selecting session keys table:</b></font><br /><b>Line:</b> '.__LINE__.'<br /><b>File:</b> '.$_SERVER['PHP_SELF']."<br /><b>Query:</b> $sql<br /><b>MySQL Error:</b> ".mysql_error() );
  940. }
  941. // This section actually checks if the table exists, if not it skips
  942. // deleting the user from this table
  943. if( mysql_fetch_array($result_key_check) )
  944. {
  945. $sql = "DELETE FROM `$phpbb_sessions_keys` WHERE `user_id`=$user_id";
  946. if( !$result = mysql_query( $sql ) )
  947. {
  948. die( '<font size="4"><b>Error deleting user from the sessions_keys table:</b></font><br /><b>Line:</b> '.__LINE__.'<br /><b>File:</b> '.$_SERVER['PHP_SELF']."<br /><b>Query:</b> $sql<br /><b>MySQL Error:</b> ".mysql_error() );
  949. }
  950. }
  951. }
  952. // ***************************************************************************
  953. //
  954. // The final sql query collets the to/from PMs with the user's id & deletes them
  955. //
  956. // ***************************************************************************
  957. // If retain_pms is set to true, change PM author to anonymous instead of deleting them
  958. if( $retain_pms == true )
  959. {
  960. // This query sets the from_user_id to the anonymous account so the PMs dont have to be deleted
  961. $sql = "UPDATE `$phpbb_privmsgs` SET `privmsgs_from_userid`=-1 WHERE `privmsgs_from_userid`=$user_id";
  962. if( !$result = mysql_query( $sql ) )
  963. {
  964. die( '<font size="4"><b>Error setting from PM from_user_id to anonymous:</b></font><br /><b>Line:</b> '.__LINE__.'<br /><b>File:</b> '.$_SERVER['PHP_SELF']."<br /><b>Query:</b> $sql<br /><b>MySQL Error:</b> ".mysql_error() );
  965. }
  966. // This query sets the to_user_id to the anonymous account so the PMs dont have to be deleted
  967. $sql = "UPDATE `$phpbb_privmsgs` SET `privmsgs_to_userid`=-1 WHERE `privmsgs_to_userid`=$user_id";
  968. if( !$result = mysql_query( $sql ) )
  969. {
  970. die( '<font size="4"><b>Error setting from PM to_user_id to anonymous:</b></font><br /><b>Line:</b> '.__LINE__.'<br /><b>File:</b> '.$_SERVER['PHP_SELF']."<br /><b>Query:</b> $sql<br /><b>MySQL Error:</b> ".mysql_error() );
  971. }
  972. }
  973. else
  974. {
  975. $sql = "SELECT `privmsgs_id` FROM `$phpbb_privmsgs` WHERE `privmsgs_from_userid`=$user_id OR `privmsgs_to_userid`=$user_id";
  976. if( !$result = mysql_query( $sql ) )
  977. {
  978. die( '<font size="4"><b>Error selecting PMs for the user:</b></font><br /><b>Line:</b> '.__LINE__.'<br /><b>File:</b> '.$_SERVER['PHP_SELF']."<br /><b>Query:</b> $sql<br /><b>MySQL Error:</b> ".mysql_error() );
  979. }
  980. // Debugging info:
  981. // echo "<br />$sql<br />";
  982. // This section marks and assigns the resulting PMs into the $marked array
  983. while($myrow = mysql_fetch_array($result))
  984. {
  985. $marked[] = $myrow['privmsgs_id'];
  986. }
  987. // Makes mark an empty array if the user has no PMs
  988. if( !isset( $marked ) )
  989. {
  990. $marked = array();
  991. }
  992. // This section actually goes through the list and deletes the PMs
  993. // Debugging info:
  994. // echo '<pre>';
  995. // print_r( $marked );
  996. if( count( $marked ) )
  997. {
  998. $delete_id = implode( ',', $marked );
  999. // Debugging info:
  1000. // echo "<br />$delete_id";
  1001. $sql = "DELETE FROM `$phpbb_privmsgs_text` WHERE `privmsgs_text_id` IN ( $delete_id )";
  1002. // Debugging info:
  1003. // echo "<br />$sql";
  1004. if( !$result = mysql_query( $sql ) )
  1005. {
  1006. die( 'Error deleting user PMs:<br />Line: '.__LINE__.'<br />File: '.$_SERVER['PHP_SELF']."<br />Query: $sql<br />MySQL Error: ".msql_error() );
  1007. }
  1008. $sql = "DELETE FROM `$phpbb_privmsgs` WHERE `privmsgs_id` IN ( $delete_id )";
  1009. // Debugging info:
  1010. // echo "<br />$sql";
  1011. if( !$result = mysql_query( $sql ) )
  1012. {
  1013. die( 'Error deleting user Pms:<br />Line: '.__LINE__.'<br />File: '.$_SERVER['PHP_SELF']."<br />Query: $sql" );
  1014. }
  1015. }
  1016. }
  1017. // And thats it! The user should now be fully and properly deleted!
  1018. }
  1019. // Delete User function
  1020. function delete_user( $user_id, $clear_posts = false, $retain_pms = false, $from = 'index' )
  1021. {
  1022. // Debugging info:
  1023. // var_dump( $user_id );
  1024. // var_dump( $clear_posts );
  1025. // var_dump( $retain_pms );
  1026. // var_dump( $from );
  1027. // Set global variables
  1028. global $index;
  1029. global $phpbb_version;
  1030. global $phpbb_banlist;
  1031. global $phpbb_user_group;
  1032. global $phpbb_users;
  1033. global $phpbb_groups;
  1034. global $phpbb_posts;
  1035. global $phpbb_posts_text;
  1036. global $phpbb_topics;
  1037. global $phpbb_vote_voters;
  1038. global $phpbb_auth_access;
  1039. global $phpbb_sessions;
  1040. global $phpbb_sessions_keys;
  1041. global $phpbb_privmsgs;
  1042. global $phpbb_privmsgs_text;
  1043. global $phpbb_topics_watch;
  1044. // Set redirect URL
  1045. if( $from == 'edit' )
  1046. {
  1047. $from ="$index?user_id=$user_id";
  1048. }
  1049. else
  1050. {
  1051. $from = $index;
  1052. }
  1053. // First, check if we are dealing with a single user, or an array of users
  1054. if( is_array( $user_id ) )
  1055. {
  1056. // Create user counter variable
  1057. $user_counter = 0;
  1058. // Loop through the array and perform security checks
  1059. // on each element before actually deleting anything
  1060. foreach( $user_id as $id )
  1061. { //user_id foreach
  1062. // First things first, sanitize the $user_id
  1063. $user_id = safe_sql( $id );
  1064. //
  1065. // Obtain username and level based on user_id
  1066. //
  1067. $sql = "SELECT * FROM $phpbb_users WHERE user_id=$id LIMIT 1";
  1068. $result = mysql_query($sql);
  1069. $myrow = mysql_fetch_array($result);
  1070. $username = safe_sql( $myrow['username'] );
  1071. $user_level = safe_sql( $myrow['user_level'] );
  1072. // Obtain first admin account to set as group mod if deleted user is a group mod (step 5)
  1073. $sql = "SELECT * FROM $phpbb_users WHERE user_level=1 ORDER BY user_id ASC LIMIT 1";
  1074. $result = mysql_query($sql);
  1075. $myrow = mysql_fetch_array($result);
  1076. $admin_id= safe_sql( $myrow['user_id'] );
  1077. // Debug info:
  1078. // echo '<pre>';
  1079. // echo gettype( $myrow );
  1080. // die( $admin_id );
  1081. // Check if admin account exists before deleting, if not return with error
  1082. if( !is_array( $myrow ) )
  1083. {
  1084. $_SESSION['errors']['edituser'][] = 'Due to the phpbb table requirements, at least one admin must exist in the database before a user can be deleted.<br />Either promote a current user to an admin, or register a new one give it admin status.';
  1085. header( "Location: $from" );
  1086. die();
  1087. }
  1088. // Check if attempting to delete the anonymous account
  1089. if( $id == -1 )
  1090. {
  1091. $_SESSION['errors']['edituser'][] = 'The anonymous account is required for phpbb to function correctly and cannot be deleted.';
  1092. continue;
  1093. }
  1094. // Check if attempting to delete an admin account
  1095. if( $user_level == 1 )
  1096. {
  1097. // Check to see if delete admin error has occured to prevent duplicate additions of the admin notification
  1098. // This way it will only list the delete error reason, then list only the admin account names on additional admin delete calls
  1099. if( !isset( $admin_delete_error ) )
  1100. {
  1101. $_SESSION['errors']['edituser'][] = "You cannot delete administrator accounts, they must first be demoted to a user.";
  1102. $admin_delete_error = true;
  1103. }
  1104. $_SESSION['errors']['edituser'][] = "<b>$username</b> is an administrator and therefore has been skipped.";
  1105. continue;
  1106. }
  1107. // This line calls the delete user core function which actually deletes the user
  1108. delete_user_core( $id, $clear_posts, $retain_pms );
  1109. $user_counter++;
  1110. } //user_id foreach
  1111. $_SESSION['errors']['edituser'][] = "$user_counter user(s) deleted successfully.";
  1112. }
  1113. else
  1114. {
  1115. // First things first, sanitize the $user_id
  1116. $user_id = safe_sql( $user_id );
  1117. //
  1118. // Obtain username and level based on user_id
  1119. //
  1120. $sql = "SELECT * FROM $phpbb_users WHERE user_id=$user_id LIMIT 1";
  1121. $result = mysql_query($sql);
  1122. $myrow = mysql_fetch_array($result);
  1123. $username = safe_sql( $myrow['username'] );
  1124. $user_level = safe_sql( $myrow['user_level'] );
  1125. // Obtain first admin account to set as group mod if deleted user is a group mod (step 5)
  1126. $sql = "SELECT * FROM $phpbb_users WHERE user_level=1 ORDER BY user_id ASC LIMIT 1";
  1127. $result = mysql_query($sql);
  1128. $myrow = mysql_fetch_array($result);
  1129. $admin_id= safe_sql( $myrow['user_id'] );
  1130. // Debug info:
  1131. // echo '<pre>';
  1132. // echo gettype( $myrow );
  1133. // die( $admin_id );
  1134. // Check if admin account exists before deleting, if not return with error
  1135. if( !is_array( $myrow ) )
  1136. {
  1137. $_SESSION['errors']['edituser'][] = 'Due to the phpbb table requirements, at least one admin must exist in the database before a user can be deleted.<br />Either promote a current user to an admin, or register a new one give it admin status.';
  1138. header( "Location: $from" );
  1139. die();
  1140. }
  1141. // Check if attempting to delete the anonymous account
  1142. if( $user_id == -1 )
  1143. {
  1144. $_SESSION['errors']['edituser'][] = 'The anonymous account is required for phpbb to function correctly and cannot be deleted.';
  1145. header( "Location: $from" );
  1146. die();
  1147. }
  1148. // Check if attempting to delete an admin account
  1149. if( $user_level == 1 )
  1150. {
  1151. $_SESSION['errors']['edituser'][] = "You cannot delete administrator accounts, they must first be demoted to a user.<br /><b>$username</b> is an administrator and therefore has been skipped.";
  1152. header( "Location: $from" );
  1153. die();
  1154. }
  1155. // This line calls the delete user core function which actually deletes the user
  1156. delete_user_core( $user_id, $clear_posts, $retain_pms );
  1157. $_SESSION['errors']['edituser'][] = "The user <b>$username</b> was deleted successfully.";
  1158. }
  1159. //
  1160. // Original delete quries were here, they have been moved to the delete_user_core() function
  1161. //
  1162. return true;
  1163. }
  1164. //////////////////////////////////////////////////////////////////////////////////
  1165. //
  1166. // checks if this script generated the session, if not clear it and send to login
  1167. if( $_SESSION['user_level'] == 'admin' || $_SESSION['user_level'] == 'mod' )
  1168. {
  1169. if( !isset( $_SESSION['status']['auth']['file'] ) || $_SESSION['status']['auth']['file'] != "$full_domain".$_SERVER['PHP_SELF'] )
  1170. {
  1171. session_destroy();
  1172. header( "Location: $index" );
  1173. die();
  1174. }
  1175. }
  1176. // Check to see if the user has selected logout
  1177. if( isset( $_GET['mode'] ) && $_GET['mode'] == "logout" )
  1178. { //1
  1179. session_destroy();
  1180. $index = $_SERVER['PHP_SELF'];
  1181. header( "Location: $index" );
  1182. } //1
  1183. // Define Session Password, Begin Login Check & Specify user status
  1184. if(isset ( $_POST['usertype'] ) )
  1185. { //1-0-1
  1186. $_SESSION['usertype'] = $_POST['usertype'];
  1187. } //1-0-1
  1188. if( isset( $_POST['password'] ) || isset( $_SESSION['password'] ) )
  1189. { //1-1
  1190. if( isset( $_POST['password'] ) )
  1191. { //1-1-1
  1192. if( $use_hashed_in_file_passwords == 'yes' || $use_toolkit_config_file == 'yes' )
  1193. {
  1194. $_SESSION['password'] = md5( md5( $_POST['password'] ) );
  1195. }
  1196. else
  1197. {
  1198. $_SESSION['password'] = $_POST['password'];
  1199. }
  1200. } //1-1-1
  1201. } //1-1
  1202. if( isset( $_SESSION['password'] ) )
  1203. { //2
  1204. //die( $adminpassword );
  1205. if( $_SESSION['usertype'] == "admin" && $_SESSION['password'] === "$adminpassword" && ( $adminpassword != '' && $adminpassword != 'd41d8cd98f00b204e9800998ecf8427e' ) )
  1206. { //2.1
  1207. $_SESSION['user_level'] = "admin";
  1208. $_SESSION['AUTH'][] = 'PHPBB Admin ToolKit'.$_SESSION['toolkitversion'];
  1209. $_SESSION['status']['auth']['file'] = "$full_domain".$_SERVER['PHP_SELF'];
  1210. $_SESSION['status']['auth']['ip'] = $_SERVER['REMOTE_ADDR'];
  1211. $_SESSION['status']['auth']['user_agent'] = $_SERVER['HTTP_USER_AGENT'];
  1212. unset( $_SESSION['password'] );
  1213. } //2.1
  1214. elseif( $_SESSION['usertype'] == "mod" && $_SESSION['password'] === "$modpassword" && ( $modpassword != '' && $modpassword != 'd41d8cd98f00b204e9800998ecf8427e' ) )
  1215. { //2.2
  1216. $_SESSION['user_level'] = "mod";
  1217. $_SESSION['AUTH'][] = 'PHPBB Admin ToolKit'.$_SESSION['toolkitversion'];
  1218. $_SESSION['status']['auth']['file'] = "$full_domain".$_SERVER['PHP_SELF'];
  1219. $_SESSION['status']['auth']['ip'] = $_SERVER['REMOTE_ADDR'];
  1220. $_SESSION['status']['auth']['user_agent'] = $_SERVER['HTTP_USER_AGENT'];
  1221. unset( $_SESSION['password'] );
  1222. } //2.2
  1223. elseif( $_SESSION['password'] == 'ENTER_ADMIN_PASSWORD_HERE' || $modpassword == 'ENTER_MOD_PASSWORD_HERE' )
  1224. { //2.3
  1225. $_SESSION['loginerror'] = 'The default password is disabled for security purposes.';
  1226. unset( $_SESSION['password'] );
  1227. } //2.3
  1228. else
  1229. { //2.4
  1230. $_SESSION['loginerror'] = 'Incorrect Password';
  1231. unset( $_SESSION['password'] );
  1232. } //2.4
  1233. } //2
  1234. // Checks to make sure the password has been changed
  1235. if( $adminpassword == 'ENTER_ADMIN_PASSWORD_HERE' || $modpassword == 'ENTER_MOD_PASSWORD_HERE' )
  1236. { //2-1
  1237. ?>
  1238. <center>
  1239. <table border="0" bgcolor="#ffffff" cellspacing="1" cellpadding="3">
  1240. <tr><td><div align="center"><?php echo $_SESSION['toolkit_title']; ?></div></td></tr>
  1241. </table><br />
  1242. </center>
  1243. <center>
  1244. <font size="3">The PHPBB ToolKit will not function untill <b>both</b> admin and mod passwords have been changed!</font>
  1245. </center>
  1246. <?php
  1247. } //2-1
  1248. // Check user status, and if valid, allow entry
  1249. elseif( $_SESSION['user_level'] == 'admin' || $_SESSION['user_level'] == 'mod' && in_array( 'PHPBB Admin ToolKit'.$_SESSION['toolkitversion'], $_SESSION['AUTH'] ) )
  1250. { //3
  1251. /* Removed cookie check
  1252. // First check if cookies are enabled
  1253. if( !isset( $_COOKIE['upload_toolkit_enabled'] ) )
  1254. {
  1255. die( "Your browser must be set to accept cookies from the <b>$domain</b> domain to use the <a href=\"http://starfoxtj.no-ip.com/phpbb/toolkit\" target=\"_blank\">PHPBB Admin ToolKit</a>.<br />Please enable your cookies and try again.
  1256. <br /><br />
  1257. In your browser, goto <b>Tools</b> -> <b>Options</b> -> <b>Privacy</b>.<br />Then either set the cookie permissions to <b>Allow</b> or set the cookie permissions for <b>$domain</b> to <b>Allow</b>.
  1258. <br /> (<b>Note:</b> Depending on the browser, the settings may be in a slightly different location.)" );
  1259. }
  1260. */
  1261. //
  1262. // Perform Session IP and user agent checks
  1263. //
  1264. // If the stored IP is not set, logout the user
  1265. if( !isset( $_SESSION['status']['auth']['ip'] ) )
  1266. {
  1267. ?>
  1268. The client IP does not exist and was not set upon login. As a fail safe he script has terminated . Please login again to reinitialize the authentication.
  1269. <br /><br />
  1270. <a href="<?php echo $_SERVER['PHP_SELF']; ?>">Click here to return to the ToolKit login screen.</a>
  1271. <?php
  1272. session_destroy();
  1273. die();
  1274. }
  1275. // Explode IP octets
  1276. $ip_parts_stored = explode( '.', $_SESSION['status']['auth']['ip'] );
  1277. $ip_parts_new = explode( '.', $_SERVER['REMOTE_ADDR'] );
  1278. if( count( $ip_parts_stored ) != 4 || count( $ip_parts_new ) != 4 )
  1279. {
  1280. ?>
  1281. An unexpected error occurred: The stored or detected IP address (used for authentication) did not contain 4 period delimitated 8-bit octets.<br />
  1282. The stored IP for this session is <b><?php echo $_SESSION['status']['auth']['ip']; ?></b>, the detected IP of you (the visitor) is <b><?php echo $_SERVER['REMOTE_ADDR']; ?></b>.<br />
  1283. Please report this error to either the board admin, or myself (starfoxtj) at <a href="mailto:starfoxtj@yahoo.com">starfoxtj@yahoo.com</a> so we can fix this error.
  1284. <?php
  1285. session_destroy();
  1286. die();
  1287. }
  1288. if( $ip_parts_stored[3] != $ip_parts_new[3] )
  1289. {
  1290. ?>
  1291. The IP address in use for this session has changed and the script execution has halted as a fail safe to prevent possible session hijacking.<br /><br />
  1292. If this is the first time you have seen this error, please continue by clicking the link below to return to the login screen.<br />
  1293. If you continue to receive this error, it is likley that you are viewing this script through a rotating proxy which may have changed your IP address.
  1294. The AOL browser is well known for exhibiting this type of behavior; it is recommended you use a use a standard browser (such as <a href="http://getfirefox.com" target="_blank">Mozilla Firefox</a> or Internet Explorer) while using this script to prevent this halt from occurring.
  1295. <br /><br />
  1296. <a href="<?php echo $_SERVER['PHP_SELF']; ?>">Click here to return to the ToolKit login screen.</a>
  1297. <?php
  1298. session_destroy();
  1299. die();
  1300. }
  1301. //
  1302. // Check user agent, since this should not change during a session
  1303. //
  1304. // If the user agent is not set, or if the user agent is different, logout the user
  1305. if( !isset( $_SESSION['status']['auth']['user_agent'] ) || $_SESSION['status']['auth']['user_agent'] != $_SERVER['HTTP_USER_AGENT'] )
  1306. {
  1307. ?>
  1308. The User Agent value in use for this session has changed and the script execution has halted as a fail safe to prevent possible session hijacking.<br />Please login again to reinitialize the authentication process.
  1309. <br /><br />
  1310. <a href="<?php echo $_SERVER['PHP_SELF']; ?>">Click here to return to the ToolKit login screen.</a>
  1311. <?php
  1312. session_destroy();
  1313. die();
  1314. }
  1315. //////////////////////////////////////////////////////////////////////////////////
  1316. //
  1317. // checks if this script generated the session, if not clear it and send to login
  1318. if( !isset( $_SESSION['status']['auth']['file'] ) || $_SESSION['status']['auth']['file'] != "$full_domain".$_SERVER['PHP_SELF'] )
  1319. {
  1320. session_destroy();
  1321. header( "Location: $index" );
  1322. die();
  1323. }
  1324. /////////////////////////////////////////////////////////
  1325. //
  1326. // Check to see if GET mode regen_anon is set
  1327. //
  1328. /////////////////////////////////////////////////////////
  1329. if( isset( $_GET['mode'] ) && $_GET['mode'] == 'regen_anon' )
  1330. {
  1331. $result = mysql_query("SELECT * FROM $phpbb_users WHERE user_id='-1'");
  1332. $myrow = mysql_fetch_array($result);
  1333. if( !isset( $myrow['user_id'] ) )
  1334. {
  1335. // echo 'User not found';
  1336. mysql_query("INSERT INTO $phpbb_users VALUES ( -1, 0, 'Anonymous', '', 0, 0, 0, 1093148721, 0, 0, '0.00', NULL, '', '', 0, 0, 0, NULL, 0, 0, 0, 1, 1, 1, 0, 1, 0, 1, 0, NULL, '', 0, '', '', '', '', '', NULL, '', '', '', '', '', '', '')");
  1337. header( "Location: $index" );
  1338. }
  1339. }
  1340. /////////////////////////////////////////////////////////
  1341. //
  1342. // Check to see if POST edit user ID or GET unban is set
  1343. //
  1344. /////////////////////////////////////////////////////////
  1345. // Update user info after changing the settings: USER LEVEL Setting
  1346. if( isset( $_POST['edit_user_id'] ) || isset( $_GET['unban'] ) || isset( $_GET['unban_banlist'] ) || isset( $_GET['banspecificid'] ) )
  1347. { //3.1
  1348. ///////////////////////////////////////////////
  1349. // Begin check if admin and add extra settings
  1350. ///////////////////////////////////////////////
  1351. if( isset( $_POST['edit_user_id'] ) )
  1352. { //3.1--1
  1353. //
  1354. // Verify new passwords match
  1355. //
  1356. if( isset( $_POST['edituser_newpass'] ) || isset( $_POST['edituser_newpassconf'] ) && $_SESSION['user_level'] == 'admin' )
  1357. {//3.1--1.1
  1358. if( $_POST['edituser_newpass'] != '' || $_POST['edituser_newpassconf'] != '' )
  1359. {
  1360. if( $_POST['edituser_newpass'] !== $_POST['edituser_newpassconf'] )
  1361. {
  1362. $user_id = $_POST['edit_user_id'];
  1363. $_SESSION['errors']['edituser'][] = 'The passwords you entered did not match.';
  1364. header( "Location: $index?user_id=$user_id ");
  1365. exit();
  1366. }
  1367. }
  1368. } //3.1--1.1
  1369. //
  1370. // Check to update joindate
  1371. //
  1372. if( isset( $_POST['update_time'] ) && $_SESSION['user_level'] == 'admin' )
  1373. { // Mark:_ Edituser operations: Update Joindate
  1374. // Set User ID
  1375. $user_id = safe_sql( $_POST['edit_user_id'] );
  1376. // Create array to pass to make_time with date info
  1377. $time['mm'] = $_POST['join_mm'];
  1378. $time['dd'] = $_POST['join_dd'];
  1379. $time['yy'] = $_POST['join_yy'];
  1380. $time['time_hh'] = $_POST['join_time_hh'];
  1381. $time['time_mm'] = $_POST['join_time_mm'];
  1382. $time['time_ss'] = $_POST['join_time_ss'];
  1383. $time['time_ap'] = $_POST['join_time_ap'];
  1384. // Obtain timestamp from make_time, send back to edit user with error if returns false
  1385. if( !$time = make_time( $time ) )
  1386. {
  1387. foreach( $_SESSION['errors']['make_time'] as $error )
  1388. {
  1389. $_SESSION['errors']['edituser'][] = $error;
  1390. }
  1391. unset( $_SESSION['errors']['make_time'] );
  1392. header( "Location: $index?user_id=$user_id ");
  1393. die();
  1394. }
  1395. // Generate SQL query
  1396. $sql = "UPDATE `$phpbb_users` SET `user_regdate`=$time WHERE `user_id`=$user_id";
  1397. if( !$result = mysql_query( $sql ) )
  1398. {
  1399. die( '<font size="4"><b>Error updating user\'s join date:</b></font><br /><b>Line:</b> '.__LINE__.'<br /><b>File:</b> '.$_SERVER['PHP_SELF']."<br /><b>Query:</b> $sql<br /><b>MySQL Error:</b> ".mysql_error() );
  1400. }
  1401. } // Mark:_ Edituser operations: Update Joindate
  1402. //
  1403. // Check to delete user
  1404. //
  1405. if( isset($_POST['delete_user']) && $_POST['delete_user'] != '' && ( $_SESSION['user_level'] == 'admin' || ( $_SESSION['user_level'] == 'mod' && $moddelete == 'yes' ) ) )
  1406. { //3.1---1
  1407. // Set user_id
  1408. $user_id = $_POST['edit_user_id'];
  1409. // Check to make sure the delete confirmation was typed correctly
  1410. if( $_POST['delete_user'] != 'delete' )
  1411. {
  1412. $_SESSION['errors']['edituser'][] = 'The word "delete" was not typed correctly.<br />The user has NOT been deleted.';
  1413. header( "Location: $index?user_id=$user_id" );
  1414. exit();
  1415. }
  1416. // Set default delete options
  1417. $clear_posts = false;
  1418. $retain_pms = false;
  1419. // Set delete options for the delete_user function
  1420. if( isset( $_POST['clear_posts'] ) )
  1421. {
  1422. $clear_posts = true;
  1423. }
  1424. if( isset( $_POST['retain_pms'] ) )
  1425. {
  1426. $retain_pms = true;
  1427. }
  1428. delete_user( $user_id, $clear_posts, $retain_pms, 'edit' ) ||
  1429. die( 'Error calling the delete_user() function on line: '.__LINE__.'<br />This is not supposed to happen. Please contact starfoxtj.' );
  1430. header( "Location: $index" );
  1431. die();
  1432. } //3.1---1
  1433. else
  1434. //
  1435. // Begin inserting additional inputs into database
  1436. //
  1437. { //3.1---2
  1438. $edituser_username = safe_sql( $_POST['edituser_username'] );
  1439. $edituser_email = safe_sql( $_POST['edituser_email'] );
  1440. $edituser_website = safe_sql( $_POST['edituser_website'] );
  1441. $edituser_location = safe_sql( $_POST['edituser_location'] );
  1442. $edituser_occupation = safe_sql( $_POST['edituser_occupation'] );
  1443. $edituser_intrests = safe_sql( $_POST['edituser_intrests'] );
  1444. $edituser_signature = safe_sql( $_POST['edituser_signature'] );
  1445. $edituser_avatar = safe_sql( $_POST['edituser_avatar'] );
  1446. $edituser_active = safe_sql( $_POST['edituser_active'] );
  1447. $edituser_allow_pm = safe_sql( $_POST['edituser_allow_pm'] );
  1448. $edituser_allowavatar = safe_sql( $_POST['edituser_allowavatar'] );
  1449. $edituser_user_allow_viewonline = safe_sql( $_POST['user_allow_viewonline'] );
  1450. $user_rank = safe_sql( $_POST['user_rank'] );
  1451. $edit_user_id = $_POST['edit_user_id'];
  1452. if( $_POST['user_avatar_type'] == '0' || $_POST['edituser_avatar'] == '' )
  1453. {
  1454. $edituser_avatar_type = 0;
  1455. $edituser_avatar = '';
  1456. }
  1457. else
  1458. {
  1459. $edituser_avatar_type = $_POST['user_avatar_type'];
  1460. }
  1461. if( $_SESSION['user_level'] == 'admin' || ( $_SESSION['user_level'] == 'mod' && $modrank == 'yes' ) )
  1462. {
  1463. $mod_allow_rank_change = "user_rank='$user_rank',";
  1464. }
  1465. else
  1466. {
  1467. $mod_allow_rank_change = '';
  1468. }
  1469. mysql_query("UPDATE $phpbb_users SET
  1470. username='$edituser_username',
  1471. user_email='$edituser_email',
  1472. user_website='$edituser_website',
  1473. user_from='$edituser_location',
  1474. user_occ='$edituser_occupation',
  1475. user_interests='$edituser_intrests',
  1476. user_sig='$edituser_signature',
  1477. user_avatar='$edituser_avatar',
  1478. $mod_allow_rank_change
  1479. user_avatar_type='$edituser_avatar_type',
  1480. user_active='$edituser_active',
  1481. user_allowavatar='$edituser_allowavatar',
  1482. user_allow_viewonline='$edituser_user_allow_viewonline',
  1483. user_allow_pm='$edituser_allow_pm'
  1484. WHERE user_id=$edit_user_id");
  1485. //
  1486. // Check if dropkey is set
  1487. //
  1488. if( isset( $_POST['edituser_dropkey'] ) && $_POST['edituser_dropkey'] == 'yes' )
  1489. {
  1490. mysql_query("UPDATE $phpbb_users SET user_actkey='' WHERE user_id=$edit_user_id");
  1491. }
  1492. if( isset( $_POST['edituser_newhash'] ) && $_POST['edituser_newhash'] != '' && $_SESSION['user_level'] == 'admin' )
  1493. {
  1494. $passhash = safe_sql( $_POST['edituser_newhash'] );
  1495. mysql_query("UPDATE $phpbb_users SET user_password='$passhash' WHERE user_id=$edit_user_id");
  1496. }
  1497. elseif( isset( $_POST['edituser_newpass'] ) && $_POST['edituser_newpass'] != '' && $_SESSION['user_level'] == 'admin' )
  1498. {
  1499. if( $_POST['edituser_newpass'] === $_POST['edituser_newpassconf'] )
  1500. {
  1501. $newpass = $_POST['edituser_newpass'];
  1502. // Hash a new password
  1503. $newpasshash = md5( $newpass );
  1504. mysql_query("UPDATE $phpbb_users SET user_password='$newpasshash' WHERE user_id=$edit_user_id");
  1505. }
  1506. }
  1507. } //3.1---2
  1508. } //3.1--1
  1509. // Disallow changing of user level to all but admin
  1510. if( isset( $_POST['edit_user_id'] ) )
  1511. { //3.1-1
  1512. if( $_SESSION['user_level'] == "admin" )
  1513. { //3.1.1
  1514. $edit_user_id = $_POST['edit_user_id'];
  1515. if( isset( $_POST['user_level'] ) && $_POST['user_level'] == "user" )
  1516. { //3.1.1.1
  1517. $user_level = 0;
  1518. } //3.1.1.1
  1519. elseif( isset( $_POST['user_level'] ) && $_POST['user_level'] == "admin" )
  1520. { //3.1.1.2
  1521. $user_level = 1;
  1522. } //3.1.1.2
  1523. if( isset( $user_level) && ( $user_level == 0 || $user_level == 1 ) )
  1524. { //3.1.1.3
  1525. $edituser_posts = $_POST['edituser_posts'];
  1526. mysql_query("UPDATE $phpbb_users SET user_level='$user_level', user_posts='$edituser_posts' WHERE user_id=$edit_user_id");
  1527. } //3.1.1.3
  1528. else
  1529. { //3.1.1.4
  1530. $edituser_posts = $_POST['edituser_posts'];
  1531. mysql_query("UPDATE $phpbb_users SET user_posts='$edituser_posts' WHERE user_id=$edit_user_id");
  1532. } //3.1.1.4
  1533. } //3.1.1
  1534. } //3.1-1
  1535. if( isset( $_POST['edit_user_id'] ) )
  1536. { //3.1-2
  1537. if( $_SESSION['user_level'] == "admin" || $modpost == 'yes' )
  1538. { // 3.1.2
  1539. $edit_user_id = $_POST['edit_user_id'];
  1540. $edituser_posts = $_POST['edituser_posts'];
  1541. mysql_query("UPDATE $phpbb_users SET user_posts='$edituser_posts' WHERE user_id=$edit_user_id");
  1542. } // 3.1.2
  1543. } //3.1-2
  1544. } //3.1
  1545. /////////////////////////////////////////////////
  1546. // Begin check and act on banning/unbanning users
  1547. /////////////////////////////////////////////////
  1548. if( isset( $_POST['banspecificuser'] ) )
  1549. { //3.2-1-0
  1550. $username = $_POST['banspecificuser'];
  1551. $result = mysql_query("SELECT * FROM $phpbb_users WHERE username='$username'");
  1552. $myrow = mysql_fetch_array($result);
  1553. $user_id = $myrow['user_id'];
  1554. if( !isset( $user_id) )
  1555. {
  1556. $_SESSION['banlist_error'] = 'The specified user does not exist.';
  1557. header( "Location: $index?mode=banlist" );
  1558. }
  1559. $result = mysql_query("SELECT * FROM $phpbb_banlist WHERE ban_userid='$user_id'");
  1560. $myrow = mysql_fetch_array($result);
  1561. mysql_query("INSERT INTO $phpbb_banlist (ban_userid) VALUES ('$user_id')");
  1562. mysql_query("UPDATE $phpbb_sessions SET session_logged_in=0 WHERE session_user_id=$user_id");
  1563. header( "Location: $index?mode=banlist" );
  1564. } //3.2-1-0
  1565. if( isset( $_POST['banspecificemail'] ) )
  1566. { //3.2-1-1
  1567. $email = $_POST['banspecificemail'];
  1568. mysql_query("INSERT INTO $phpbb_banlist ( ban_email) VALUES ('$email')");
  1569. header( "Location: $index?mode=banlist#email" );
  1570. } //3.2-1-1
  1571. if( isset( $_POST['editban'] ) || isset( $_GET['unban'] ) || isset( $_GET['unban_banlist'] ) )
  1572. { //3.2--1
  1573. if( isset( $_POST['editban'] ) )
  1574. { //3.2-1
  1575. $edit_user_id = $_POST['edit_user_id'];
  1576. } //3.2-1
  1577. $allowban = 'no';
  1578. if( $_SESSION['user_level'] == "admin" )
  1579. { //3.2.1
  1580. $allowban = 'yes';
  1581. } //3.2.1
  1582. elseif( $_SESSION['user_level'] == "mod" && $modban == 'yes' )
  1583. { //3.2.2
  1584. $allowban = 'yes';
  1585. } //3.2.2
  1586. if( $allowban == 'yes' )
  1587. { //3.2.4
  1588. if( isset( $_POST['editban'] ) && $_POST['editban'] == "yes" )
  1589. { //3.2.4.1
  1590. if( $edit_user_id == -1 )
  1591. { //3.2.4.1-1
  1592. $_SESSION['errors']['index'][] = 'The Anonymous user account is <b>required</b><br />for PHPBB to function and cannot be banned.';
  1593. } //3.2.4.1-1
  1594. else
  1595. { //3.2.4.1-2
  1596. mysql_query("INSERT INTO $phpbb_banlist (ban_userid) VALUES ('$edit_user_id')");
  1597. mysql_query("UPDATE $phpbb_sessions SET session_logged_in=0 WHERE session_user_id=$edit_user_id");
  1598. } //3.2.4.1-2
  1599. } //3.2.4.1
  1600. if( ( isset( $_POST['editban'] ) && $_POST['editban'] == "no" ) || isset( $_GET['unban']) )
  1601. { //3.2.4.2
  1602. if( isset( $_GET['unban'] ) )
  1603. { //3.2.4.2.1
  1604. $edit_user_id = $_GET['unban'];
  1605. } //3.2.4.2.1
  1606. mysql_query("DELETE FROM $phpbb_banlist WHERE ban_userid=$edit_user_id");
  1607. } //3.2.4.2
  1608. if( isset( $_GET['unban_banlist'] ) )
  1609. {
  1610. $ban_id = $_GET['unban_banlist'];
  1611. mysql_query("DELETE FROM $phpbb_banlist WHERE ban_id=$ban_id");
  1612. header( "Location: $index?mode=banlist#ip" );
  1613. }
  1614. } //3.2.4
  1615. elseif( $allowban == 'no' )
  1616. { //3.2.5
  1617. $_SESSION['errors']['index'][] = 'You do <b>not</b> have Permission to Ban/Unban Users.';
  1618. } //3.2.5
  1619. }//3.2--1
  1620. /////////////////////////////////////////////////////////
  1621. //
  1622. // Check to see if Anon account exists
  1623. //
  1624. /////////////////////////////////////////////////////////
  1625. $user_id = -1;
  1626. $result = mysql_query("SELECT * FROM $phpbb_users WHERE user_id='$user_id'");
  1627. $myrow = mysql_fetch_array($result);
  1628. if( !isset( $myrow['user_id'] ) )
  1629. {
  1630. $anonymous_exist = 'Notice: The Anonymous account does not exist!<br />Click <a href="?mode=regen_anon">here</a> to recreate it.';
  1631. // The following if statement first checks to see if the anon error is already in the array
  1632. // Only if it is not, will it add it.
  1633. // This prevents adding the anon error twice
  1634. if( isset( $_SESSION['errors']['index'] ) )
  1635. {
  1636. if( !in_array( $anonymous_exist, $_SESSION['errors']['index'] ) )
  1637. {
  1638. $_SESSION['errors']['index'][] = $anonymous_exist;
  1639. }
  1640. }
  1641. else
  1642. {
  1643. $_SESSION['errors']['index'][] = $anonymous_exist;
  1644. }
  1645. }
  1646. ////////////////////////////////////////////////
  1647. //
  1648. // Check to see if board config has been edited
  1649. //
  1650. ////////////////////////////////////////////////
  1651. if( isset( $_POST['edit_board_config'] ) && $_SESSION['user_level'] == 'admin' )
  1652. {
  1653. $server_name = safe_sql( $_POST['server_name'] );
  1654. $server_port = safe_sql( $_POST['server_port'] );
  1655. $script_path = safe_sql( $_POST['script_path'] );
  1656. $sitename = safe_sql( $_POST['sitename'] );
  1657. $site_desc = safe_sql( $_POST['site_desc'] );
  1658. $board_disable = safe_sql( $_POST['board_disable'] );
  1659. $require_activation = safe_sql( $_POST['require_activation'] );
  1660. $board_email_form = safe_sql( $_POST['board_email_form'] );
  1661. $gzip_compress = safe_sql( $_POST['gzip_compress'] );
  1662. $prune_enable = safe_sql( $_POST['prune_enable'] );
  1663. $cookie_domain = safe_sql( $_POST['cookie_domain'] );
  1664. $cookie_name = safe_sql( $_POST['cookie_name'] );
  1665. $cookie_path = safe_sql( $_POST['cookie_path'] );
  1666. $cookie_secure = safe_sql( $_POST['cookie_secure'] );
  1667. $session_length = safe_sql( $_POST['session_length'] );
  1668. $board_email = safe_sql( $_POST['board_email'] );
  1669. $board_email_sig = safe_sql( $_POST['board_email_sig'] );
  1670. $smtp_delivery = safe_sql( $_POST['smtp_delivery'] );
  1671. $smtp_host = safe_sql( $_POST['smtp_host'] );
  1672. $smtp_username = safe_sql( $_POST['smtp_username'] );
  1673. $smtp_password = safe_sql( $_POST['smtp_password'] );
  1674. $default_style = safe_sql( $_POST['default_style'] );
  1675. $override_user_style = safe_sql( $_POST['override_user_style'] );
  1676. mysql_query("UPDATE $phpbb_config SET config_value='$server_name' WHERE config_name='server_name'");
  1677. mysql_query("UPDATE $phpbb_config SET config_value='$server_port' WHERE config_name='server_port'");
  1678. mysql_query("UPDATE $phpbb_config SET config_value='$script_path' WHERE config_name='script_path'");
  1679. mysql_query("UPDATE $phpbb_config SET config_value='$sitename' WHERE config_name='sitename'");
  1680. mysql_query("UPDATE $phpbb_config SET config_value='$site_desc' WHERE config_name='site_desc'");
  1681. mysql_query("UPDATE $phpbb_config SET config_value='$board_disable' WHERE config_name='board_disable'");
  1682. mysql_query("UPDATE $phpbb_config SET config_value='$require_activation' WHERE config_name='require_activation'");
  1683. mysql_query("UPDATE $phpbb_config SET config_value='$board_email_form' WHERE config_name='board_email_form'");
  1684. mysql_query("UPDATE $phpbb_config SET config_value='$gzip_compress' WHERE config_name='gzip_compress'");
  1685. mysql_query("UPDATE $phpbb_config SET config_value='$prune_enable' WHERE config_name='prune_enable'");
  1686. mysql_query("UPDATE $phpbb_config SET config_value='$cookie_domain' WHERE config_name='cookie_domain'");
  1687. mysql_query("UPDATE $phpbb_config SET config_value='$cookie_name' WHERE config_name='cookie_name'");
  1688. mysql_query("UPDATE $phpbb_config SET config_value='$cookie_path' WHERE config_name='cookie_path'");
  1689. mysql_query("UPDATE $phpbb_config SET config_value='$cookie_secure' WHERE config_name='cookie_secure'");
  1690. mysql_query("UPDATE $phpbb_config SET config_value='$session_length' WHERE config_name='session_length'");
  1691. mysql_query("UPDATE $phpbb_config SET config_value='$board_email' WHERE config_name='board_email'");
  1692. mysql_query("UPDATE $phpbb_config SET config_value='$board_email_sig' WHERE config_name='board_email_sig'");
  1693. mysql_query("UPDATE $phpbb_config SET config_value='$smtp_delivery' WHERE config_name='smtp_delivery'");
  1694. mysql_query("UPDATE $phpbb_config SET config_value='$smtp_host' WHERE config_name='smtp_host'");
  1695. mysql_query("UPDATE $phpbb_config SET config_value='$smtp_username' WHERE config_name='smtp_username'");
  1696. mysql_query("UPDATE $phpbb_config SET config_value='$smtp_password' WHERE config_name='smtp_password'");
  1697. mysql_query("UPDATE $phpbb_config SET config_value='$default_style' WHERE config_name='default_style'");
  1698. mysql_query("UPDATE $phpbb_config SET config_value='$override_user_style' WHERE config_name='override_user_style'");
  1699. if( isset( $_POST['reset_subsilver'] ) && $_POST['reset_subsilver'] == 1 )
  1700. {
  1701. $reset_subsilver_id = $_POST['reset_subsilver_id'];
  1702. mysql_query("DELETE FROM phpbb_themes WHERE themes_id='$reset_subsilver_id' LIMIT 1") or die( 'Could not delete phpbb_themes on subsilver reset!');
  1703. mysql_query("DELETE FROM phpbb_themes_name WHERE themes_id='$reset_subsilver_id' LIMIT 1") or die( 'Could not delete phpbb_themes on subsilver reset!');
  1704. mysql_query("INSERT INTO $phpbb_themes (themes_id, template_name, style_name, head_stylesheet, body_background, body_bgcolor, body_text, body_link, body_vlink, body_alink, body_hlink, tr_color1, tr_color2, tr_color3, tr_class1, tr_class2, tr_class3, th_color1, th_color2, th_color3, th_class1, th_class2, th_class3, td_color1, td_color2, td_color3, td_class1, td_class2, td_class3, fontface1, fontface2, fontface3, fontsize1, fontsize2, fontsize3, fontcolor1, fontcolor2, fontcolor3, span_class1, span_class2, span_class3) VALUES ('$reset_subsilver_id', 'subSilver', 'subSilver', 'subSilver.css', '', 'E5E5E5', '000000', '006699', '5493B4', '', 'DD6900', 'EFEFEF', 'DEE3E7', 'D1D7DC', '', '', '', '98AAB1', '006699', 'FFFFFF', 'cellpic1.gif', 'cellpic3.gif', 'cellpic2.jpg', 'FAFAFA', 'FFFFFF', '', 'row1', 'row2', '', 'Verdana, Arial, Helvetica, sans-serif', 'Trebuchet MS', 'Courier, \'Courier New\', sans-serif', 10, 11, 12, '444444', '006600', 'FFA34F', '', '', '')") or die( 'Could not update phpbb_themes on subsilver reset!');
  1705. mysql_query("INSERT INTO $phpbb_themes_name (themes_id, tr_color1_name, tr_color2_name, tr_color3_name, tr_class1_name, tr_class2_name, tr_class3_name, th_color1_name, th_color2_name, th_color3_name, th_class1_name, th_class2_name, th_class3_name, td_color1_name, td_color2_name, td_color3_name, td_class1_name, td_class2_name, td_class3_name, fontface1_name, fontface2_name, fontface3_name, fontsize1_name, fontsize2_name, fontsize3_name, fontcolor1_name, fontcolor2_name, fontcolor3_name, span_class1_name, span_class2_name, span_class3_name) VALUES ('$reset_subsilver_id', 'The lightest row colour', 'The medium row color', 'The darkest row colour', '', '', '', 'Border round the whole page', 'Outer table border', 'Inner table border', 'Silver gradient picture', 'Blue gradient picture', 'Fade-out gradient on index', 'Background for quote boxes', 'All white areas', '', 'Background for topic posts', '2nd background for topic posts', '', 'Main fonts', 'Additional topic title font', 'Form fonts', 'Smallest font size', 'Medium font size', 'Normal font size (post body etc)', 'Quote & copyright text', 'Code text colour', 'Main table header text colour', '', '', '')") or die( 'Could not phpbb_themes_name on subsilver reset!');
  1706. }
  1707. if( isset( $_POST['update_time'] ) )
  1708. {
  1709. // Create array to pass to make_time with date info
  1710. $time['mm'] = $_POST['join_mm'];
  1711. $time['dd'] = $_POST['join_dd'];
  1712. $time['yy'] = $_POST['join_yy'];
  1713. $time['time_hh'] = $_POST['join_time_hh'];
  1714. $time['time_mm'] = $_POST['join_time_mm'];
  1715. $time['time_ss'] = $_POST['join_time_ss'];
  1716. $time['time_ap'] = $_POST['join_time_ap'];
  1717. // Obtain timestamp from make_time, send back to edit user with error if returns false
  1718. if( !$time = make_time( $time ) )
  1719. {
  1720. foreach( $_SESSION['errors']['make_time'] as $error )
  1721. {
  1722. $_SESSION['errors']['config'][] = $error;
  1723. }
  1724. unset( $_SESSION['errors']['make_time'] );
  1725. header( "Location: $index?mode=config ");
  1726. die();
  1727. }
  1728. // Generate SQL query
  1729. $sql = "UPDATE `$phpbb_config` SET `config_value`=$time WHERE `config_name`='board_startdate'";
  1730. if( !$result = mysql_query( $sql ) )
  1731. {
  1732. die( '<font size="4"><b>Error updating board\'s start date:</b></font><br /><b>Line:</b> '.__LINE__.'<br /><b>File:</b> '.$_SERVER['PHP_SELF']."<br /><b>Query:</b> $sql<br /><b>MySQL Error:</b> ".mysql_error() );
  1733. }
  1734. }
  1735. // $_SESSION['errors']['index'][] = 'Board config updated';
  1736. header( "Location: $index" );
  1737. die();
  1738. }
  1739. /////////////////////////////////////////////////////////
  1740. //
  1741. // Check to see if POST editspecific user has information
  1742. //
  1743. /////////////////////////////////////////////////////////
  1744. if( isset( $_POST['editspecificuser'] ) )
  1745. { //3.1-1
  1746. $_SESSION['start'] = 0;
  1747. $username = str_replace( '*', '%', $_POST['editspecificuser'] );
  1748. $result = mysql_query("SELECT * FROM $phpbb_users WHERE username='$username'");
  1749. $myrow = mysql_fetch_array($result);
  1750. $index = $_SERVER['PHP_SELF'];
  1751. $user_id = $myrow['user_id'];
  1752. if( !isset( $myrow['user_id'] ) )
  1753. {
  1754. if( $username == '' )
  1755. {
  1756. $_SESSION['search'] = '';
  1757. header( "Location: $index" );
  1758. }
  1759. else
  1760. {
  1761. header( "Location: $index?search=$username ");
  1762. }
  1763. }
  1764. elseif( isset( $_SESSION['search_by'] ) && $_SESSION['search_by'] == 'skipping direct edit and going to search only' )
  1765. {
  1766. header( "Location: $index?user_id=$user_id ");
  1767. }
  1768. else
  1769. {
  1770. $_SESSION['search'] = $username;
  1771. header( "Location: $index" );
  1772. }
  1773. } //3.1-1
  1774. /////////////////////////////////////////////////////////
  1775. //
  1776. // Check to see if GET=phpinfo is set
  1777. //
  1778. /////////////////////////////////////////////////////////
  1779. elseif( isset($_GET['mode'] ) && $_GET['mode'] == 'phpinfo' && $_SESSION['user_level'] == 'admin' )
  1780. { //3.1-1a
  1781. phpinfo();
  1782. } //3.1-1a
  1783. /////////////////////////////////////////////////////////
  1784. //
  1785. // Check to see if GET=id is set to show edit user screen
  1786. //
  1787. /////////////////////////////////////////////////////////
  1788. elseif( isset( $_GET['user_id'] ) || isset( $_GET['resync'] ) )
  1789. { //3.2
  1790. if( isset( $_GET['resync'] ) )
  1791. {
  1792. $user_id = $_GET['resync'];
  1793. $result = mysql_query("SELECT * FROM $phpbb_users WHERE user_id=$user_id");
  1794. $myrow = mysql_fetch_array($result);
  1795. $user_post_count_result = mysql_query("SELECT * FROM $phpbb_posts WHERE poster_id=$user_id");
  1796. $user_post_count = mysql_num_rows($user_post_count_result);
  1797. }
  1798. else
  1799. {
  1800. $user_id = $_GET['user_id'];
  1801. $result = mysql_query("SELECT * FROM $phpbb_users WHERE user_id=$user_id");
  1802. $myrow = mysql_fetch_array($result);
  1803. }
  1804. if( !isset( $myrow['user_id'] ) )
  1805. {
  1806. $_SESSION['errors']['index'][] = "The specified user does not exist.";
  1807. $index = $_SERVER['PHP_SELF'];
  1808. header( "Location: $index ");
  1809. }
  1810. ///////////////////////////////////////////////
  1811. ///
  1812. /// Checks if a mod is trying to edit an admin
  1813. if( $_SESSION['user_level'] == 'mod' && $myrow['user_level'] == 1 )
  1814. {
  1815. $_SESSION['errors']['index'][] = 'You do not have permission to edit admin accounts.';
  1816. header( "Location: $index" );
  1817. }
  1818. $bantable = mysql_query("SELECT * FROM $phpbb_banlist WHERE ban_userid=$user_id");
  1819. $banstat = 'no';
  1820. $banrow = mysql_fetch_array($bantable);
  1821. if( isset( $banrow['ban_userid'] ) )
  1822. { //3.2.1
  1823. $banstat = 'yes';
  1824. } //3.2.1
  1825. $_SESSION['edit_user_avatar_type'] = $myrow['user_avatar_type'];
  1826. $avatar_set = true;
  1827. if( $myrow['user_avatar_type'] == 0 )
  1828. {
  1829. $avatar_path = '';
  1830. $avatar_set = false;
  1831. }
  1832. elseif( $myrow['user_avatar_type'] == 1 )
  1833. {
  1834. $avatar_result = mysql_query("SELECT * FROM $phpbb_config WHERE config_name='avatar_path'");
  1835. $myrowavatar = mysql_fetch_array($avatar_result);
  1836. $avatar_path = $myrowavatar['config_value'].'/';
  1837. }
  1838. elseif( $myrow['user_avatar_type'] == 2 )
  1839. {
  1840. $avatar_path = '';
  1841. }
  1842. elseif( $myrow['user_avatar_type'] == 3 )
  1843. {
  1844. $avatar_result = mysql_query("SELECT * FROM $phpbb_config WHERE config_name='avatar_gallery_path'");
  1845. $myrowavatar = mysql_fetch_array($avatar_result);
  1846. $avatar_path = $myrowavatar['config_value'].'/';
  1847. }
  1848. ?>
  1849. <html>
  1850. <head>
  1851. <title>PHPBB Admin ToolKit v<?php echo $_SESSION['toolkitversion']; ?></title>
  1852. </head>
  1853. <body link="#0000ff" vlink="#0000ff" alink="#0000ff">
  1854. <center>
  1855. <table border="0" bgcolor="#ffffff" cellspacing="1" cellpadding="3">
  1856. <tr><td><div align="center"><?php echo $_SESSION['toolkit_title']; ?></div></td></tr>
  1857. </table><br />
  1858. <?php
  1859. // Begin error reporting section
  1860. if( isset( $_SESSION['errors']['edituser'] ) )
  1861. {
  1862. foreach( $_SESSION['errors']['edituser'] as $error )
  1863. {
  1864. echo $error;
  1865. echo "<br />\n";
  1866. }
  1867. unset( $_SESSION['errors']['edituser'] );
  1868. }
  1869. // End error reporting section
  1870. ?>
  1871. </center>
  1872. <center>
  1873. <table border="0" width="60%" bgcolor="ffffff" cellpadding="0">
  1874. <tr><td colspan="2" align="right"><a href="<?php echo $_SERVER['PHP_SELF']; ?>">Cancel</a></td></tr>
  1875. <tr><td><font size="5"><b>Edit User: #<?php echo $myrow['user_id']; ?></b> - <?php echo $myrow['username']; ?></font></td><td align="right">Logged in as: <b><?php echo $_SESSION['user_level']; ?></b>
  1876. </td></tr>
  1877. </table>
  1878. <table width="60%" style="border:1px solid black;" bgcolor="#000000" cellspacing="1" cellpadding="0">
  1879. <tr>
  1880. <td bgcolor="#e5e5e5">
  1881. <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="POST">
  1882. <input type="hidden" name="edit_user_id" value="<?php echo $myrow['user_id']; ?>">
  1883. <table border="0" cellpadding="" cellspacing="10">
  1884. <tr>
  1885. <td>Username:</td>
  1886. <td><input type="text" name="edituser_username" value="<?php echo $myrow['username']; ?>" style="border-right: black 1px solid; border-top: black 1px solid; border-left: black 1px solid; border-bottom: black 1px solid" size="35" length="255" maxlength="255"<?php if( $_SESSION['user_level'] != "admin" ) { echo ' readonly'; } ?>></td>
  1887. </tr>
  1888. <tr>
  1889. <td>Email:</td>
  1890. <td><input type="text" name="edituser_email" value="<?php echo $myrow['user_email']; ?>" style="border-right: black 1px solid; border-top: black 1px solid; border-left: black 1px solid; border-bottom: black 1px solid" size="35" length="255" maxlength="255"<?php if( $_SESSION['user_level'] != "admin" ) { echo ' readonly'; } ?>></td>
  1891. </tr>
  1892. <tr>
  1893. <td>Post Count:</td>
  1894. <td><input type="text" name="edituser_posts" value="<?php echo $myrow['user_posts']; ?>" style="border-right: black 1px solid; border-top: black 1px solid; border-left: black 1px solid; border-bottom: black 1px solid" size="7" length="7" maxlength="20"<?php if( $_SESSION['user_level'] != "admin" ) { if( $_SESSION['user_level'] != "admin" && $modpost == 'no' ) { echo ' readonly'; } } ?>> <?php
  1895. if( isset( $_GET['resync'] ) )
  1896. {
  1897. if( $myrow['user_posts'] != $user_post_count )
  1898. {
  1899. $user_post_count = "<font color=\"#ff0000\"><b>$user_post_count</b></font>";
  1900. }
  1901. else
  1902. {
  1903. $user_post_count = $user_post_count;
  1904. }
  1905. echo '( <a href="?resync='.$myrow['user_id'].'">Resync</a>: Actual Post Count: '.$user_post_count.' )';
  1906. }
  1907. else
  1908. {
  1909. echo '( <a href="?resync='.$myrow['user_id'].'">Resync</a> )';
  1910. }
  1911. ?></td>
  1912. </tr>
  1913. <tr>
  1914. <td>User Level:</td>
  1915. <td><?php
  1916. // Disallow User Level to be Editable Unless viewed by Admin
  1917. if( $_SESSION['user_level'] == "admin" )
  1918. { //3.2.2
  1919. if( $myrow['user_level'] == 1 )
  1920. { //3.2.2.1
  1921. echo '<select name="user_level">';
  1922. echo '<option value="admin" selected>Admin';
  1923. echo '<OPTION value="user">User';
  1924. echo '</select>';
  1925. } //3.2.2.1
  1926. elseif( $myrow['user_level'] == 0 )
  1927. { //3.2.3.1
  1928. echo '<select name="user_level">';
  1929. echo '<option value="admin">Admin';
  1930. echo '<OPTION value="user" selected>User';
  1931. echo '</select>';
  1932. } //3.2.4.1
  1933. elseif( $myrow['user_level'] == 2 )
  1934. { //3.2.5.1
  1935. echo '<b>Moderator</b> - Change N/A';
  1936. } //3.2.5.1
  1937. } //3.2.2
  1938. else
  1939. { //3.2.3
  1940. if( $myrow['user_level'] == 0 )
  1941. { //3.2.3.1
  1942. $user_level = 'User';
  1943. } // 3.2.3.1
  1944. if( $myrow['user_level'] == 1 )
  1945. { //3.2.3.2
  1946. $user_level = 'Admin';
  1947. } // 3.2.3.2
  1948. if( $myrow['user_level'] == 2 )
  1949. { //3.2.3.3
  1950. $user_level = 'Mod';
  1951. } // 3.2.3.3
  1952. echo '<b>'.$user_level.'</b>';
  1953. } //3.2.3
  1954. ?></td>
  1955. </tr>
  1956. <tr>
  1957. <td>User is Banned:</td>
  1958. <td><?php
  1959. if( $_SESSION['user_level'] == 'admin' || $modban == 'yes' )
  1960. { //3.2.6.1
  1961. if( $banstat == "no" )
  1962. { //3.2.6.1.1
  1963. echo '<input type="radio" name="editban" value="yes">Yes&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="radio" name="editban" value="no" checked="checked">No';
  1964. } //3.2.6.1.1
  1965. elseif( $banstat == "yes" )
  1966. { //3.2.6.1.2
  1967. echo '<input type="radio" name="editban" value="yes" checked="checked">Yes&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="radio" name="editban" value="no">No';
  1968. } //3.2.6.1.2
  1969. else
  1970. { //3.2.6.1.3
  1971. echo '(<b>Problem:</b> This message should not be listed. Please contact <a href="http://www.geocities.com/starfoxtj" target="_blank">starfoxtj@yahoo.com</a>';
  1972. } //3.2.6.1.3
  1973. } //3.2.6.1
  1974. else
  1975. { //3.2.6.2
  1976. if($banstat == "yes")
  1977. { //3.2.6.2.1
  1978. $listbanstat = "Yes";
  1979. } //3.2.6.2.1
  1980. elseif($banstat == "no")
  1981. { //3.2.6.2.2
  1982. $listbanstat = "No";
  1983. } //3.2.6.2.2
  1984. else
  1985. { //3.2.6.2.3
  1986. echo "You should not be seeing this messege, please contact <a href=\"http://starfoxtj.no-ip.com/phpbb/toolkit\">starfoxtj</a>";
  1987. } //3.2.6.2.3
  1988. echo "<b>$listbanstat</b>";
  1989. } //3.2.6.2
  1990. ?></td>
  1991. </tr>
  1992. <tr>
  1993. <td>
  1994. &nbsp;
  1995. </td>
  1996. <td>
  1997. <a href="search.php?search_author=<?php echo $myrow['username']; ?>" target="_blank">Display User Posts</a> - <a href="privmsg.php?mode=post&u=<?php echo $myrow['user_id']; ?>" target="_blank">PM User</a>
  1998. </td>
  1999. </tr>
  2000. </table>
  2001. <?php
  2002. if( 0 == 0 )
  2003. { //3.2.6.3
  2004. ?>
  2005. </td>
  2006. </tr>
  2007. <tr bgcolor="#f5f5f5">
  2008. <td>
  2009. <table border="0" cellpadding="" cellspacing="10">
  2010. <tr>
  2011. <td colspan="2"><font size="2">(Extra Settings)</font><br /></td>
  2012. </tr>
  2013. <?php
  2014. if( $_SESSION['user_level'] == 'admin' )
  2015. {
  2016. ?>
  2017. <tr>
  2018. <td><br />Password Hash:</td>
  2019. <td><br /><?php echo $myrow['user_password']; ?></td>
  2020. </tr>
  2021. <tr>
  2022. <td>New hash:</td>
  2023. <td><input type="text" name="edituser_newhash" style="border-right: black 1px solid; border-top: black 1px solid; border-left: black 1px solid; border-bottom: black 1px solid" size="35" length="255" maxlength="255"></td>
  2024. </tr>
  2025. <tr>
  2026. <td><br />New Password:</td>
  2027. <td><br /><input type="password" name="edituser_newpass" style="border-right: black 1px solid; border-top: black 1px solid; border-left: black 1px solid; border-bottom: black 1px solid" size="35" length="255" maxlength="255"></td>
  2028. </tr>
  2029. <tr>
  2030. <td>Confirm Password:</td>
  2031. <td><input type="password" name="edituser_newpassconf" style="border-right: black 1px solid; border-top: black 1px solid; border-left: black 1px solid; border-bottom: black 1px solid" size="35" length="255" maxlength="255"></td>
  2032. </tr>
  2033. </table>
  2034. <br /><center><hr width="90%"></center><br />
  2035. <?php
  2036. //
  2037. // Date Section
  2038. //
  2039. $date_joined = $myrow['user_regdate'];
  2040. $date_joined_ap = date( "a", $date_joined );
  2041. $date_lastvisit = $myrow['user_lastvisit'];
  2042. ?>
  2043. <table border="0" cellpadding="" cellspacing="10">
  2044. <tr>
  2045. <td>Date Joined:</td>
  2046. <td>
  2047. <input type="text" name="join_mm" value="<?php echo date( "m", $date_joined ); ?>" style="border-right: black 1px solid; border-top: black 1px solid; border-left: black 1px solid; border-bottom: black 1px solid" size="1" maxlength="2" /> /
  2048. <input type="text" name="join_dd" value="<?php echo date( "d", $date_joined ); ?>" style="border-right: black 1px solid; border-top: black 1px solid; border-left: black 1px solid; border-bottom: black 1px solid" size="1" maxlength="2" /> /
  2049. <input type="text" name="join_yy" value="<?php echo date( "Y", $date_joined ); ?>" style="border-right: black 1px solid; border-top: black 1px solid; border-left: black 1px solid; border-bottom: black 1px solid" size="3" maxlength="4" />
  2050. (mm/dd/yyyy)<br />
  2051. </td>
  2052. </tr>
  2053. <tr>
  2054. <td>&nbsp;</td>
  2055. <td>
  2056. <input type="text" name="join_time_hh" value="<?php echo date( "h", $date_joined ); ?>" style="border-right: black 1px solid; border-top: black 1px solid; border-left: black 1px solid; border-bottom: black 1px solid" size="1" maxlength="2" />h :
  2057. <input type="text" name="join_time_mm" value="<?php echo date( "i", $date_joined ); ?>" style="border-right: black 1px solid; border-top: black 1px solid; border-left: black 1px solid; border-bottom: black 1px solid" size="1"maxlength="2" />m
  2058. <input type="text" name="join_time_ss" value="<?php echo date( "s", $date_joined ); ?>" style="border-right: black 1px solid; border-top: black 1px solid; border-left: black 1px solid; border-bottom: black 1px solid" size="1"maxlength="2" />s
  2059. <select name="join_time_ap">
  2060. <option value="am"<?php if( $date_joined_ap == 'am' ) { echo ' selected'; } ?>>AM</option>
  2061. <option value="pm"<?php if( $date_joined_ap == 'pm' ) { echo ' selected'; } ?>>PM</option>
  2062. </select>
  2063. </td>
  2064. </tr>
  2065. <tr>
  2066. <td>
  2067. &nbsp;
  2068. </td>
  2069. <td>
  2070. <input type="checkbox" name="update_time" />Check to enabled join date change.
  2071. </td>
  2072. </tr>
  2073. <tr>
  2074. <td>&nbsp;</td>
  2075. </tr>
  2076. <tr>
  2077. <td>Last Visit:</td>
  2078. <td>
  2079. <?php if( $myrow['user_lastvisit'] == 0 ) { echo '-'; } else { echo date( "F jS Y, h:ia", $date_lastvisit ); } ?>
  2080. </td>
  2081. </tr>
  2082. </table>
  2083. <br /><center><hr width="90%"></center><br />
  2084. <?php
  2085. }
  2086. ?>
  2087. <table border="0" cellpadding="" cellspacing="10">
  2088. <tr>
  2089. <td>WebSite:</td>
  2090. <td><input type="text" name="edituser_website" value="<?php echo $myrow['user_website']; ?>" style="border-right: black 1px solid; border-top: black 1px solid; border-left: black 1px solid; border-bottom: black 1px solid" size="35" length="255" maxlength="255"></td>
  2091. </tr>
  2092. <tr>
  2093. <td>Location:</td>
  2094. <td><input type="text" name="edituser_location" value="<?php echo $myrow['user_from']; ?>" style="border-right: black 1px solid; border-top: black 1px solid; border-left: black 1px solid; border-bottom: black 1px solid" size="35" length="255" maxlength="255"></td>
  2095. </tr>
  2096. <tr>
  2097. <td>Occupation:</td>
  2098. <td><input type="text" name="edituser_occupation" value="<?php echo $myrow['user_occ']; ?>" style="border-right: black 1px solid; border-top: black 1px solid; border-left: black 1px solid; border-bottom: black 1px solid" size="35" length="255" maxlength="255"></td>
  2099. </tr>
  2100. <tr>
  2101. <td>Interests:</td>
  2102. <td><input type="text" name="edituser_intrests" value="<?php echo $myrow['user_interests']; ?>" style="border-right: black 1px solid; border-top: black 1px solid; border-left: black 1px solid; border-bottom: black 1px solid" size="35" length="255" maxlength="255"></td>
  2103. </tr>
  2104. <tr>
  2105. <td colspan="2">Signature:<br /><textarea class="post" name="edituser_signature" rows="6" cols="45"><?php echo $myrow['user_sig']; ?></textarea></td>
  2106. </tr>
  2107. </table>
  2108. <br /><center><hr width="90%"></center><br />
  2109. <table border="0" cellpadding="" cellspacing="10">
  2110. <tr>
  2111. <td valign="top"><?php if( $avatar_set == true ) { echo '<a href="'.$avatar_path.''.$myrow['user_avatar'].'" target="_blank">User Avatar:</a>'; } else { echo 'Remote Avatar:'; } ?></td><td><input type="text" name="edituser_avatar" value="<?php echo $myrow['user_avatar']; ?>" style="border-right: black 1px solid; border-top: black 1px solid; border-left: black 1px solid; border-bottom: black 1px solid" size="47" length="255" maxlength="255"></td>
  2112. </tr>
  2113. <tr>
  2114. <td>&nbsp;</td>
  2115. <td><input type="radio" name="user_avatar_type" value="2"<?php if( $myrow['user_avatar_type'] == 2 ) { echo ' checked'; } ?> />Remote&nbsp;&nbsp;&nbsp;<input type="radio" name="user_avatar_type" value="3"<?php if( $myrow['user_avatar_type'] == 3 ) { echo ' checked'; } ?> />Gallery&nbsp;&nbsp;&nbsp;<input type="radio" name="user_avatar_type" value="1"<?php if( $myrow['user_avatar_type'] == 1 ) { echo ' checked'; } ?> />Uploaded&nbsp;&nbsp;&nbsp;<input type="radio" name="user_avatar_type" value="0"<?php if( $myrow['user_avatar_type'] == 0 ) { echo ' checked'; } ?> />None</td>
  2116. </tr>
  2117. </table>
  2118. <br /><center><hr width="90%"></center><br />
  2119. <table border="0" cellpadding="" cellspacing="10">
  2120. <?php
  2121. if( $_SESSION['user_level'] == 'admin' || $modrank == 'yes' )
  2122. { //3.2.6.3.1
  2123. ?>
  2124. <tr>
  2125. <td>
  2126. Rank:
  2127. </td>
  2128. <td><select name="user_rank">
  2129. <option value="0">No special rank assigned</option>
  2130. <?php
  2131. // Begin Rank Listings
  2132. $rankresult = mysql_query("SELECT * FROM $phpbb_ranks ORDER BY rank_id ASC");
  2133. while( $rankmyrow = mysql_fetch_array($rankresult) )
  2134. {
  2135. if( $rankmyrow['rank_special'] == 1 )
  2136. {
  2137. if( $myrow['user_rank'] == $rankmyrow['rank_id'] )
  2138. {
  2139. $isrank = ' selected="selected"';
  2140. }
  2141. else
  2142. {
  2143. $isrank = '';
  2144. }
  2145. echo '<option value="'.$rankmyrow['rank_id'].'"'.$isrank.'>'.$rankmyrow['rank_title'].'</option>';
  2146. }
  2147. }
  2148. ?>
  2149. </select>
  2150. </td>
  2151. </tr>
  2152. <tr>
  2153. <td colspan="2"><hr width="100%"></td>
  2154. </tr>
  2155. <?php
  2156. } //3.2.6.3.1
  2157. ?>
  2158. <tr>
  2159. <td>Is Active?:</td><td><input type="radio" name="edituser_active" value="1"<?php if( $myrow['user_active'] == 1 ){ echo ' checked="checked"'; }?>>Yes&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="radio" name="edituser_active" value="0"<?php if( $myrow['user_active'] == 0 ){ echo ' checked="checked"'; }?>>No&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Drop Activaton Key: <input type="checkbox" name="edituser_dropkey" value="yes" /></td>
  2160. </tr>
  2161. <tr>
  2162. <td colspan="2"><hr width="100%"></td>
  2163. </tr>
  2164. <tr>
  2165. <td>Enable PM?:</td><td><input type="radio" name="edituser_allow_pm" value="1"<?php if( $myrow['user_allow_pm'] == 1 ){ echo ' checked="checked"'; }?>>Yes&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="radio" name="edituser_allow_pm" value="0"<?php if( $myrow['user_allow_pm'] == 0 ){ echo ' checked="checked"'; }?>>No</td>
  2166. </tr>
  2167. <tr>
  2168. <td colspan="2"><hr width="100%"></td>
  2169. </tr>
  2170. <tr>
  2171. <td>Use Avatar?:</td><td><input type="radio" name="edituser_allowavatar" value="1"<?php if( $myrow['user_allowavatar'] == 1 ){ echo ' checked="checked"'; }?>>Yes&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="radio" name="edituser_allowavatar" value="0"<?php if( $myrow['user_allowavatar'] == 0 ){ echo ' checked="checked"'; }?>>No</td>
  2172. <tr>
  2173. <td colspan="2"><hr width="100%"></td>
  2174. </tr>
  2175. <tr>
  2176. <td>Hidden?:</td><td><input type="radio" name="user_allow_viewonline" value="0"<?php if( $myrow['user_allow_viewonline'] == 0 ){ echo ' checked="checked"'; }?>>Yes&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="radio" name="user_allow_viewonline" value="1"<?php if( $myrow['user_allow_viewonline'] == 1 ){ echo ' checked="checked"'; }?>>No</td>
  2177. </tr>
  2178. <td colspan="2"><hr width="100%"></td>
  2179. </tr>
  2180. <?php
  2181. if( $_SESSION['user_level'] == 'admin' || $moddelete == 'yes' )
  2182. { //3.2.6.3.2
  2183. ?>
  2184. <tr>
  2185. <td>Delete User:</td><td><input type="text" name="delete_user" style="border-right: black 1px solid; border-top: black 1px solid; border-left: black 1px solid; border-bottom: black 1px solid" size="7" length="6" maxlength="6"> (Type delete)</font></td>
  2186. </tr>
  2187. <tr>
  2188. <td valign="top">Options: </td>
  2189. <td>
  2190. <input type="checkbox" name="clear_posts" value="yes" />Clear Posts (Great for Spammers)<br />
  2191. <input type="checkbox" name="retain_pms" value="yes" />Retain PMs<br />
  2192. </td>
  2193. </tr>
  2194. <?php
  2195. } //3.2.6.3.2
  2196. ?>
  2197. </table>
  2198. <?php
  2199. } //3.2.6.3
  2200. ?>
  2201. <br /><center><input TYPE="submit" VALUE=" Update "></center><br />
  2202. </form>
  2203. </td>
  2204. </tr>
  2205. </table>
  2206. <table border="0" width="60%" bgcolor="ffffff">
  2207. <tr><td><a href="<?php echo $_SERVER['PHP_SELF']; ?>">Cancel</a></td></tr>
  2208. </table>
  2209. <?php echo $_SESSION['copyrightfooter']; ?>
  2210. </center>
  2211. </body>
  2212. </html>
  2213. <?php
  2214. } //3.2
  2215. /////////////////////////////////////
  2216. //
  2217. // Check to see if mode=mysql is set
  2218. //
  2219. /////////////////////////////////////
  2220. elseif( isset($_GET['mode'] ) && $_GET['mode'] == 'mysql' && $_SESSION['user_level'] == 'admin' )
  2221. { //3.2-1-1
  2222. echo 'Would normaly list the MySQL Qurey.<br /><a href="'.$_SERVER['PHP_SELF'].'">Back</a>';
  2223. } //3.2-1-1
  2224. /////////////////////////////////////////////
  2225. //
  2226. // Check to see if mode=,scan is set
  2227. //
  2228. /////////////////////////////////////////////
  2229. elseif( isset($_GET['mode'] ) && $_GET['mode'] == 'security_scan' )
  2230. { //3.2-2-security_scan
  2231. if( $_SESSION['user_level'] == 'admin' )
  2232. { //3.2-2-1
  2233. /////////////////////////////////////////////////////////////////////////////////////////
  2234. //
  2235. // Tables for the security check
  2236. //
  2237. /////////////////////////////////////////////////////////////////////////////////////////
  2238. //
  2239. // Check if query string is set to sanitize a description
  2240. //
  2241. if( isset( $_GET['sanitize'] ) )
  2242. {
  2243. // check if santize is for site
  2244. if( $_GET['sanitize'] == 'site_desc' )
  2245. {
  2246. $desc_id = safe_sql( $_GET['sanitize'] );
  2247. $result = mysql_query("SELECT * FROM $phpbb_config WHERE config_name='site_desc' LIMIT 1");
  2248. $myrow = mysql_fetch_array($result);
  2249. // Sanitize forum_desc
  2250. $desc = safe_sql( $myrow['config_value'] );
  2251. mysql_query("UPDATE $phpbb_config SET config_value='$desc' WHERE config_name='site_desc' LIMIT 1");
  2252. }
  2253. else // Sanitize is for forum
  2254. {
  2255. $desc_id = safe_sql( $_GET['sanitize'] );
  2256. $result = mysql_query("SELECT * FROM $phpbb_forums WHERE forum_id='$desc_id' ORDER BY forum_name ASC LIMIT 1");
  2257. $myrow = mysql_fetch_array($result);
  2258. // Check if forum exists
  2259. if( !is_numeric( $myrow['forum_id'] ) )
  2260. {
  2261. die( 'Script Halted. Forum_ID does not exist or is in an incorrect format' );
  2262. }
  2263. // Sanitize forum_desc
  2264. $desc = safe_sql( $myrow['forum_desc'] );
  2265. mysql_query("UPDATE $phpbb_forums SET forum_desc='$desc' WHERE forum_id=$desc_id LIMIT 1");
  2266. }
  2267. // Redirect back to security scan
  2268. header( "Location: ?mode=security_scan#site_descriptions" );
  2269. die();
  2270. }
  2271. ?>
  2272. <html>
  2273. <head>
  2274. <title>PHPBB Admin ToolKit v<?php echo $_SESSION['toolkitversion']; ?></title>
  2275. </head>
  2276. <body link="#0000ff" vlink="#0000ff" alink="#0000ff">
  2277. <?php
  2278. echo '<center>';
  2279. echo '<table border="0" bgcolor="#ffffff" cellspacing="1" cellpadding="3">';
  2280. echo '<tr><td colspan="2">'.$_SESSION['toolkit_title'],'</div></td></tr>';
  2281. echo '<tr><td>Logged in as: <b>'.$_SESSION['user_level'].'</b></td><td align="right"><a href="'.$_SERVER['PHP_SELF'].'">Back</a></td></tr></table>';
  2282. ?>
  2283. <br />
  2284. <table width="60%" style="border:1px solid black;" bgcolor="#000000" cellspacing="1" cellpadding="0">
  2285. <tr>
  2286. <td bgcolor="f5f5f5">
  2287. <table border="0" bgcolor="#e5e5e5" cellpadding="5" width="100%">
  2288. <tr>
  2289. <td>
  2290. <a name="general"><font size="4"><b>What is the security scan?</b></font>
  2291. </td>
  2292. </tr>
  2293. </table>
  2294. <table border="0" cellpadding="" cellspacing="10">
  2295. <tr>
  2296. <td>
  2297. This security scan tool is designed to quickly summarize and display all important security related information in one page. It will check if your <b>phpbb installation is up-to-date</b> and (if permitted in the settings) if the <b>Admin ToolKit is up-to-date</b>. It will list all <b>administrator accounts</b> and <b>moderator accounts</b>, allowing you to <b>easily spot imposters</b>.
  2298. <br /><br />
  2299. It will also scan all <b>forum descriptions</b> showing you the actual text it contains, and will <b>highlight any potentially harmful information</b>. The vast majority of defacements resulting from hacked boards are <b>stored in the forums descriptions; using javascript, iframes and the like</b>. You can then quickly check and remove any harmful information stored in these areas.
  2300. <br /><br />
  2301. Jump To:
  2302. <ul>
  2303. <li><a href="#updates">Update Checks</a></li>
  2304. <li><a href="#user_accounts">User Accounts</a></li>
  2305. <li><a href="#descriptions">Descriptions</a></li>
  2306. <ul>
  2307. <li><a href="#site_descriptions">Site Description</a></li>
  2308. <li><a href="#forum_descriptions">Forum Descriptions</a></li>
  2309. </ul>
  2310. </ul>
  2311. </td>
  2312. </tr>
  2313. </table>
  2314. </td>
  2315. </tr>
  2316. </table>
  2317. <br /><br /><br /><br />
  2318. <?php
  2319. //
  2320. // Seperator table
  2321. //
  2322. ?>
  2323. <table width="95%" style="border:1px solid black;" bgcolor="#000000" cellspacing="1" cellpadding="0">
  2324. <tr>
  2325. <td bgcolor="f5f5f5">
  2326. <table border="0" bgcolor="#e5e5e5" cellpadding="5" width="100%">
  2327. <tr>
  2328. <td>
  2329. <a name="updates"><font size="4"><b>Section #1: Update Checks</b></font>
  2330. </td>
  2331. </tr>
  2332. </table>
  2333. <table border="0" cellpadding="" cellspacing="10">
  2334. <tr>
  2335. <td>
  2336. This section is used to quickly check if your installation of phpbb and the toolkit are up to date.
  2337. <br /><br />
  2338. The phpbb update check is done by reading the version information in the phpbb_config table in your database. It then reads a text file on phpbb.com which lists the latest version. Then it compares the two values to determine your version status.
  2339. The default phpbb update file is located at: <a href="http://www.phpbb.com/updatecheck/20x.txt" target="_blank">http://www.phpbb.com/updatecheck/20x.txt</a>
  2340. <br /><br />
  2341. The toolkit update check is done almost exactly the same way, the only difference, is that the installed version information is stored in the toolkit.php file itself. The toolkit reads the text file 2.x.txt from my website which lists the latest version. Then it compares the two values to determine your version status.
  2342. The default toolkit update file is located at: <a href="http://starfoxtj.no-ip.com/phpbb/toolkit/updatecheck/2.x.txt" target="_blank">http://starfoxtj.no-ip.com/phpbb/toolkit/updatecheck/2.x.txt</a>
  2343. </td>
  2344. </tr>
  2345. </table>
  2346. </td>
  2347. </tr>
  2348. </table>
  2349. <?php
  2350. ///////////////////////
  2351. //
  2352. // Table for updatechecks
  2353. //
  2354. ///////////////////////
  2355. ?>
  2356. <center>
  2357. <table>
  2358. <table width="95%" border="0" bgcolor="#ffffff" cellspacing="1" cellpadding="3">
  2359. <tr>
  2360. <td>
  2361. <center>
  2362. <table width="100%" border="0" bgcolor="#ffffff" cellspacing="1" cellpadding="3">
  2363. <tr><td width="20%">
  2364. &nbsp;
  2365. </td>
  2366. <td align="center" nowrap>
  2367. &nbsp;
  2368. </td>
  2369. <td align="right" width="10%">
  2370. <a href="<?php echo $_SERVER['PHP_SELF']; ?>">Back</a>
  2371. </td>
  2372. </tr>
  2373. </table>
  2374. <center><table width="100%" style="border:2px solid black;" bgcolor="#f5f5f5" cellspacing="1" cellpadding="3">
  2375. <tr>
  2376. <td bgcolor="#d5d5d5" width="20" cellpadding="5">
  2377. <div align="center"><b>Product:</b></div>
  2378. </td>
  2379. <td bgcolor="#d5d5d5" width="15%" cellpadding="5">
  2380. <div align="center"><b>Installed Version:</b></div>
  2381. </td>
  2382. <td bgcolor="#d5d5d5" width="15%" cellpadding="5">
  2383. <div align="center"><b>Latest Version:</b></div>
  2384. </td>
  2385. <td bgcolor="#d5d5d5" width="50%" cellpadding="5">
  2386. <div align="center"><b>Details:</b></div>
  2387. </td>
  2388. </tr>
  2389. <?php
  2390. //
  2391. // PHPBB Version Check
  2392. //
  2393. // Get PHPBB version from the database
  2394. $result = mysql_query("SELECT * FROM $phpbb_config WHERE config_name='version' LIMIT 1");
  2395. $myrow = mysql_fetch_array($result);
  2396. $version['current'] = '2'.$myrow['config_value'];
  2397. // See if check is permitted
  2398. if( $update_url['phpbb'] == 'none' )
  2399. {
  2400. $version['color'] = 'FFEA00';
  2401. $version['new'] = 'Disabled';
  2402. $version['details'] = '<b>PHPBB Update Check Disabled:</b><br />The PHPBB update check has been disabled in the toolkit.php file. Please goto <a href="http://www.phpbb.com/downloads.php" target="_blank">http://www.phpbb.com</a> and check to see if you have the latest version..<br />If you want to enable the phpbb update check, please do so by changing the $update_url[\'phpbb\'] value to the update URL.';
  2403. }
  2404. else
  2405. {
  2406. //Check phpbb latest version online
  2407. $version['new'] = ( $info = trim( @file_get_contents( $update_url['phpbb'] ) ) ) ? $info : 'Unknown';
  2408. $version['new'] = str_replace( "\n", '.', $version['new'] );
  2409. // Set warn color and check current vs latest version
  2410. switch( $version['new'] )
  2411. {
  2412. case 'Unknown':
  2413. $version['color'] = 'FFEA00';
  2414. $version['details'] = '<b>Error Reading update file:</b><br />Either your server disables "allow_url_fopen" in the php.ini file, or the update server is offline. Please goto <a href="http://www.phpbb.com/downloads.php" target="_blank">http://www.phpbb.com</a> and check to see if you have the latest version.';
  2415. break;
  2416. case $version['current']:
  2417. $version['color'] = '45BF10';
  2418. $version['details'] = 'Your PHPBB installation is up to date.';
  2419. break;
  2420. case $version['current'] != $version['new']:
  2421. $version['color'] = 'ff0000';
  2422. $version['details'] = '<b>Your PHPBB installation is outdated:</b><br />You are at risk of possible <b>exploits, sql injections, defacements, hijacks and other attacks!</b><br />It is <b>highly</b> recommended that you goto <a href="http://www.phpbb.com/downloads.php" target="_blank">http://www.phpbb.com</a> and update to the latest version as soon as possible.';
  2423. break;
  2424. default:
  2425. $version['color'] = '45BF10';
  2426. $version['details'] = '<b>Script Error:</b><br />The version check did not resolve to either unknown, current or non-current. This is not supposed to happen.<br />Please send an email to <a href="mailto:starfoxtj@yahoo.com">starfoxtj@yahoo.com</a> about this error.';
  2427. }
  2428. }
  2429. ?>
  2430. <tr>
  2431. <td bgcolor="#c5c5c5"><a href="http://www.phpbb.com" target="blank">PHPBB</a> (The Forum)</td>
  2432. <td bgcolor="#e5e5e5" align="center"><b><?php echo $version['current']; ?></b></td>
  2433. <td bgcolor="#<?php echo $version['color']; ?>" align="center"><b><?php echo $version['new']; ?></b></td>
  2434. <td bgcolor="#e5e5e5"><?php echo $version['details']; ?></td>
  2435. </tr>
  2436. <?php
  2437. //
  2438. // ToolKit Version Check
  2439. //
  2440. // Set ToolKit version from variable
  2441. $version['current'] = $_SESSION['toolkitversion'];
  2442. // See if check is permitted
  2443. if( $update_url['toolkit'] == 'none' )
  2444. {
  2445. $version['color'] = 'FFEA00';
  2446. $version['new'] = 'Disabled';
  2447. $version['details'] = '<b>ToolKit Update Check Disabled:</b><br />The toolkit update check has been disabled in the toolkit.php file. Please goto <a href="http://starfoxtj.no-ip.com/phpbb/toolkit" target="_blank">http://starfoxtj.no-ip.com/phpbb/toolkit</a> and check to see if you have the latest version.<br />If you want to enable the toolkit update check, please do so by changing the $update_url[\'toolkit\'] value to the update URL.';
  2448. }
  2449. else
  2450. {
  2451. //Check phpbb latest version online
  2452. $version['new'] = ( $info = trim( @file_get_contents( $update_url['toolkit'] ) ) ) ? $info : 'Unknown';
  2453. // Set warn color and check current vs latest version
  2454. switch( $version['new'] )
  2455. {
  2456. case 'Unknown':
  2457. $version['color'] = 'FFEA00';
  2458. $version['details'] = '<b>Error Reading update file:</b><br />Either your server disables "allow_url_fopen" in the php.ini file, or the update server is offline. Please goto <a href="http://starfoxtj.no-ip.com/phpbb/toolkit" target="_blank">http://starfoxtj.no-ip.com/phpbb/toolkit</a> and check to see if you have the latest version.';
  2459. break;
  2460. case $version['current']:
  2461. $version['color'] = '45BF10';
  2462. $version['details'] = 'Your ToolKit installation is up to date.';
  2463. break;
  2464. case $version['current'] != $version['new']:
  2465. $version['color'] = 'ff0000';
  2466. $version['details'] = '<b>Your ToolKit installation is outdated:</b><br />It is recommended that you goto <a href="http://starfoxtj.no-ip.com/phpbb/toolkit" target="_blank">http://starfoxtj.no-ip.com/phpbb/toolkit</a> and download the latest version of this toolkit. Most updates include just feature additions, but some may include security fixes. You <i>may</i> be at risk for security exploits if you dont update. (Update changes are listed on my website)';
  2467. break;
  2468. default:
  2469. $version['color'] = '45BF10';
  2470. $version['details'] = '<b>Script Error:</b><br />The version check did not resolve to either unknown, current or non-current. This is not supposed to happen.<br />Please send an email to <a href="mailto:starfoxtj@yahoo.com">starfoxtj@yahoo.com</a> about this error.';
  2471. }
  2472. }
  2473. ?>
  2474. <tr>
  2475. <td bgcolor="#c5c5c5"><a href="http://starfoxtj.no-ip.com/phpbb/toolkit" target="blank">PHPBB Admin ToolKit</a></td>
  2476. <td bgcolor="#e5e5e5" align="center"><b><?php echo $version['current']; ?></b></td>
  2477. <td bgcolor="#<?php echo $version['color']; ?>" align="center"><b><?php echo $version['new']; ?></b></td>
  2478. <td bgcolor="#e5e5e5"><?php echo $version['details']; ?></td>
  2479. </tr>
  2480. <?php
  2481. echo "</table></center>";
  2482. ?>
  2483. </td>
  2484. </tr>
  2485. </table>
  2486. </center>
  2487. <?php
  2488. ///////////////////////
  2489. //
  2490. // Table for updatechecks
  2491. //
  2492. ///////////////////////
  2493. ?>
  2494. <?php
  2495. //
  2496. // Seperator table
  2497. //
  2498. ?>
  2499. <br /><br /><br /><br />
  2500. <?php
  2501. //
  2502. // Seperator table
  2503. //
  2504. ?>
  2505. <table width="95%" style="border:1px solid black;" bgcolor="#000000" cellspacing="1" cellpadding="0">
  2506. <tr>
  2507. <td bgcolor="f5f5f5">
  2508. <table border="0" bgcolor="#e5e5e5" cellpadding="5" width="100%">
  2509. <tr>
  2510. <td>
  2511. <a name="user_accounts"><font size="4"><b>Section #2: User Accounts</b></font>
  2512. </td>
  2513. </tr>
  2514. </table>
  2515. <table border="0" cellpadding="" cellspacing="10">
  2516. <tr>
  2517. <td>
  2518. This is the section concerning user account security. Many hackers promote backdoor accounts to administrators so they can return later and have full access to your board.
  2519. <br /><br />Listed below are <b>all</b> the administrators and moderators. Look through the list and make sure that no unknown accounts exist. If you see an account that should not be there, click its name to demote or ban that user.
  2520. </td>
  2521. </tr>
  2522. </table>
  2523. </td>
  2524. </tr>
  2525. </table>
  2526. <?php
  2527. //
  2528. // Seperator table
  2529. //
  2530. ?>
  2531. <?php
  2532. ///////////////////////
  2533. //
  2534. // Table for admins
  2535. //
  2536. ///////////////////////
  2537. ?>
  2538. <center>
  2539. <table>
  2540. <table width="95%" border="0" bgcolor="#ffffff" cellspacing="1" cellpadding="3">
  2541. <tr>
  2542. <td>
  2543. <center>
  2544. <table width="100%" border="0" bgcolor="#ffffff" cellspacing="1" cellpadding="3">
  2545. <tr><td width="20%">
  2546. <a name="administrators"><b>Board Administrators:</b></a>
  2547. </td>
  2548. <td align="center" nowrap>
  2549. &nbsp;
  2550. </td>
  2551. <td align="right" width="10%">
  2552. <a href="<?php echo $_SERVER['PHP_SELF']; ?>">Back</a>
  2553. </td>
  2554. </tr>
  2555. </table>
  2556. <center><table width="100%" style="border:2px solid black;" bgcolor="#f5f5f5" cellspacing="1" cellpadding="3">
  2557. <tr>
  2558. <td bgcolor="#d5d5d5" width="10%" cellpadding="5">
  2559. <div align="center"><b>ID:</a></div>
  2560. </td>
  2561. <td bgcolor="#d5d5d5" width="20%" cellpadding="5">
  2562. <div align="center"><b>Username:</b></div>
  2563. </td>
  2564. <td bgcolor="#d5d5d5" width="20%" cellpadding="5">
  2565. <div align="center"><b>Email:</b></div>
  2566. </td>
  2567. <td bgcolor="#d5d5d5" width="8%" cellpadding="5">
  2568. <div align="center"><b>Posts:</b></div>
  2569. </td>
  2570. <td bgcolor="#d5d5d5" width="8%" cellpadding="5">
  2571. <div align="center"><b>Level:</b></div>
  2572. </td>
  2573. <td bgcolor="#d5d5d5" width="7%" cellpadding="5">
  2574. <div align="center"><b>Active:</b></div>
  2575. </td>
  2576. <td bgcolor="#d5d5d5" width="7%" cellpadding="5">
  2577. <div align="center"><b>Joined:</b></div>
  2578. </td>
  2579. <td bgcolor="#d5d5d5" width="7%" cellpadding="5">
  2580. <div align="center"><b>Visit:</b></div>
  2581. </td>
  2582. <td bgcolor="#d5d5d5" width="10%" cellpadding="5">
  2583. <div align="center"><b>Ban:</b></div>
  2584. </td>
  2585. </tr>
  2586. <?php
  2587. $result = mysql_query("SELECT * FROM $phpbb_users WHERE user_level=1 ORDER BY username ASC");
  2588. while( $myrow = mysql_fetch_array($result) )
  2589. { //3.10
  2590. if( $myrow['user_level'] == 0 )
  2591. { //3.10.1
  2592. $userlevel = "User";
  2593. } //3.10.1
  2594. elseif( $myrow['user_level'] == 1 )
  2595. { //3.10.2
  2596. $userlevel = "Admin";
  2597. } //3.10.2
  2598. elseif( $myrow['user_level'] == 2 )
  2599. { //3.10.3
  2600. $userlevel = "Mod";
  2601. } //3.10.3
  2602. if( $myrow['user_active'] == 1 )
  2603. { //3.10.3-1
  2604. $useractive = "Yes";
  2605. } //3.10.3-1
  2606. else
  2607. { //3.10.3-2
  2608. $useractive = "No";
  2609. } //3.10.3-2
  2610. $user_id = $myrow['user_id'];
  2611. $bantable = mysql_query("SELECT * FROM $phpbb_banlist WHERE ban_userid=$user_id");
  2612. $banstat = '-';
  2613. $banrow = mysql_fetch_array($bantable);
  2614. if( isset( $banrow['ban_userid'] ) )
  2615. { //3.10.4
  2616. $banstat = '<b>Banned</b>';
  2617. } //3.10.4
  2618. $useremail = $myrow['user_email'];
  2619. $useremailshort = $useremail;
  2620. if ( strlen( $useremail ) > 17 )
  2621. { //3.10.6.2
  2622. $emaildots = "";
  2623. } //3.10.6.2
  2624. else
  2625. { //3.10.6.2
  2626. $emaildots = "";
  2627. } //3.10.6.2
  2628. ?>
  2629. <tr>
  2630. <td bgcolor="#c5c5c5"><div align="left"><?php echo $myrow['user_id']; ?></div></td>
  2631. <td bgcolor="#e5e5e5"><div align="left"><a href="?user_id=<?php echo $myrow['user_id']; ?>" target="_blank"><?php echo $myrow['username']; ?></a></div></td>
  2632. <td bgcolor="#c5C5c5" nowrap><div align="left"><a href="mailto:<?php echo $useremail; ?>"><?php if( $myrow['user_id'] == -1 ) { echo '<center>-</center>'; } else { ?>&nbsp;<?php echo $useremailshort; echo $emaildots; } ?></a></div></td>
  2633. <td bgcolor="#e5e5e5"><div align="right"><?php echo $myrow['user_posts']; ?></div></td>
  2634. <td bgcolor="#c5C5c5"><div align="right"><?php echo $userlevel; ?></div></td>
  2635. <td bgcolor="#e5e5E5"><div align="center"><?php echo $useractive; ?></div></td>
  2636. <td bgcolor="#c5C5c5" nowrap><div align="center" style="font-family: Verdana; font-size: 9px;"><?php echo date( "m/d/Y", $myrow['user_regdate'] ); ?></div></td>
  2637. <td bgcolor="#e5e5E5" align="center" nowrap><?php if( $myrow['user_lastvisit'] == 0 ) { echo '-'; } else { echo '<div style="font-family: Verdana; font-size: 9px;">'.date( "m/d/Y", $myrow['user_lastvisit'] ).'</div>'; } ?></td>
  2638. <td bgcolor="#c5C5c5"><div align="center"><?php echo $banstat; ?></div></td>
  2639. </tr>
  2640. <?php
  2641. } //3.10
  2642. echo "</table></center>";
  2643. ?>
  2644. </td>
  2645. </tr>
  2646. </table>
  2647. <?php
  2648. ///////////////////////
  2649. //
  2650. // Table for admins
  2651. //
  2652. ///////////////////////
  2653. ?>
  2654. <br />
  2655. <?php
  2656. ///////////////////////
  2657. //
  2658. // Table for mods
  2659. //
  2660. ///////////////////////
  2661. ?>
  2662. <center>
  2663. <table>
  2664. <table width="95%" border="0" bgcolor="#ffffff" cellspacing="1" cellpadding="3">
  2665. <tr>
  2666. <td>
  2667. <center>
  2668. <table width="100%" border="0" bgcolor="#ffffff" cellspacing="1" cellpadding="3">
  2669. <tr><td width="20%">
  2670. <a name="moderators"><b>Board Moderators:</b></a>
  2671. </td>
  2672. <td align="center" nowrap>
  2673. &nbsp;
  2674. </td>
  2675. <td align="right" width="10%">
  2676. <a href="<?php echo $_SERVER['PHP_SELF']; ?>">Back</a>
  2677. </td>
  2678. </tr>
  2679. </table>
  2680. <center><table width="100%" style="border:2px solid black;" bgcolor="#f5f5f5" cellspacing="1" cellpadding="3">
  2681. <tr>
  2682. <td bgcolor="#d5d5d5" width="10%" cellpadding="5">
  2683. <div align="center"><b>ID:</a></div>
  2684. </td>
  2685. <td bgcolor="#d5d5d5" width="20%" cellpadding="5">
  2686. <div align="center"><b>Username:</b></div>
  2687. </td>
  2688. <td bgcolor="#d5d5d5" width="20%" cellpadding="5">
  2689. <div align="center"><b>Email:</b></div>
  2690. </td>
  2691. <td bgcolor="#d5d5d5" width="8%" cellpadding="5">
  2692. <div align="center"><b>Posts:</b></div>
  2693. </td>
  2694. <td bgcolor="#d5d5d5" width="8%" cellpadding="5">
  2695. <div align="center"><b>Level:</b></div>
  2696. </td>
  2697. <td bgcolor="#d5d5d5" width="7%" cellpadding="5">
  2698. <div align="center"><b>Active:</b></div>
  2699. </td>
  2700. <td bgcolor="#d5d5d5" width="7%" cellpadding="5">
  2701. <div align="center"><b>Joined:</b></div>
  2702. </td>
  2703. <td bgcolor="#d5d5d5" width="7%" cellpadding="5">
  2704. <div align="center"><b>Visit:</b></div>
  2705. </td>
  2706. <td bgcolor="#d5d5d5" width="10%" cellpadding="5">
  2707. <div align="center"><b>Ban:</b></div>
  2708. </td>
  2709. </tr>
  2710. <?php
  2711. $result = mysql_query("SELECT * FROM $phpbb_users WHERE user_level=2 ORDER BY username ASC");
  2712. while( $myrow = mysql_fetch_array($result) )
  2713. { //3.10
  2714. if( $myrow['user_level'] == 0 )
  2715. { //3.10.1
  2716. $userlevel = "User";
  2717. } //3.10.1
  2718. elseif( $myrow['user_level'] == 1 )
  2719. { //3.10.2
  2720. $userlevel = "Admin";
  2721. } //3.10.2
  2722. elseif( $myrow['user_level'] == 2 )
  2723. { //3.10.3
  2724. $userlevel = "Mod";
  2725. } //3.10.3
  2726. if( $myrow['user_active'] == 1 )
  2727. { //3.10.3-1
  2728. $useractive = "Yes";
  2729. } //3.10.3-1
  2730. else
  2731. { //3.10.3-2
  2732. $useractive = "No";
  2733. } //3.10.3-2
  2734. $user_id = $myrow['user_id'];
  2735. $bantable = mysql_query("SELECT * FROM $phpbb_banlist WHERE ban_userid=$user_id");
  2736. $banstat = '-';
  2737. $banrow = mysql_fetch_array($bantable);
  2738. if( isset( $banrow['ban_userid'] ) )
  2739. { //3.10.4
  2740. $banstat = '<b>Banned</b>';
  2741. } //3.10.4
  2742. $useremail = $myrow['user_email'];
  2743. $useremailshort = $useremail;
  2744. if ( strlen( $useremail ) > 17 )
  2745. { //3.10.6.2
  2746. $emaildots = "";
  2747. } //3.10.6.2
  2748. else
  2749. { //3.10.6.2
  2750. $emaildots = "";
  2751. } //3.10.6.2
  2752. ?>
  2753. <tr>
  2754. <td bgcolor="#c5c5c5"><div align="left"><?php echo $myrow['user_id']; ?></div></td>
  2755. <td bgcolor="#e5e5e5"><div align="left"><a href="?user_id=<?php echo $myrow['user_id']; ?>" target="_blank"><?php echo $myrow['username']; ?></a></div></td>
  2756. <td bgcolor="#c5C5c5" nowrap><div align="left"><a href="mailto:<?php echo $useremail; ?>"><?php if( $myrow['user_id'] == -1 ) { echo '<center>-</center>'; } else { ?>&nbsp;<?php echo $useremailshort; echo $emaildots; } ?></a></div></td>
  2757. <td bgcolor="#e5e5e5"><div align="right"><?php echo $myrow['user_posts']; ?></div></td>
  2758. <td bgcolor="#c5C5c5"><div align="right"><?php echo $userlevel; ?></div></td>
  2759. <td bgcolor="#e5e5E5"><div align="center"><?php echo $useractive; ?></div></td>
  2760. <td bgcolor="#c5C5c5" nowrap><div align="center" style="font-family: Verdana; font-size: 9px;"><?php echo date( "m/d/Y", $myrow['user_regdate'] ); ?></div></td>
  2761. <td bgcolor="#e5e5E5" align="center" nowrap><?php if( $myrow['user_lastvisit'] == 0 ) { echo '-'; } else { echo '<div style="font-family: Verdana; font-size: 9px;">'.date( "m/d/Y", $myrow['user_lastvisit'] ).'</div>'; } ?></td>
  2762. <td bgcolor="#c5C5c5"><div align="center"><?php echo $banstat; ?></div></td>
  2763. </tr>
  2764. <?php
  2765. } //3.10
  2766. echo "</table></center>";
  2767. ?>
  2768. </td>
  2769. </tr>
  2770. </table>
  2771. <?php
  2772. ///////////////////////
  2773. //
  2774. // Table for mods
  2775. //
  2776. ///////////////////////
  2777. ?>
  2778. <br /><br /><br /><br />
  2779. <?php
  2780. //
  2781. // Seperator table
  2782. //
  2783. ?>
  2784. <table width="95%" style="border:1px solid black;" bgcolor="#000000" cellspacing="1" cellpadding="0">
  2785. <tr>
  2786. <td bgcolor="f5f5f5">
  2787. <table border="0" bgcolor="#e5e5e5" cellpadding="5" width="100%">
  2788. <tr>
  2789. <td>
  2790. <a name="descriptions"><font size="4"><b>Section #3: Descriptions</b></font></a>
  2791. </td>
  2792. </tr>
  2793. </table>
  2794. <table border="0" cellpadding="" cellspacing="10">
  2795. <tr>
  2796. <td>
  2797. The majority of hackers who gain access to your board add malicious information into your forum or site descriptions. The most common are the javascript, and iframe tags. By adding these to your descriptions, they can embed "hacked by" messages, songs, music and page redirects.
  2798. <br />
  2799. Most of the harmful tags cannot be seen by viewing the forum index.
  2800. <br /><br />
  2801. This section scans all forum descriptions showing you the actual text, including the added information.
  2802. <br />
  2803. This scrip will scan for the following tags: <b>&lt;, &gt;, &lt;script, &lt;javascript, script&gt;, &lt;iframe, &lt;frame, iframe&gt;, frame&gt;, &lt;embed, embed&gt;</b>
  2804. <br /><br />
  2805. The first two characters, are considered a minor risk. The rest, are considered major risks. (Explained below).
  2806. <br /><br />
  2807. On most hacked forums where the hacker added an iframe or javascript into a description, the board administrator is unable to view the forum, or even enter the admin panel to remove it. With this tool, if any harmful or malicious tags are detected in the forum description, you have the option to <b>Sanitize</b> it. Sanitation converts the characters that make the tags harmful, into safe, non-harmful equivalents.
  2808. <br /><br />
  2809. The two special characters that allow the script and javascript tags to be harmful, are the left and right arrows. The left and right arrows, when surrounding a body of text, are invisible when viewed through a browser. When this script sanitized a description, it converts the left and right arrows, into harmless "html entities". An html entity is a code value that is used to represent the left and right arrows (among other special characters). The left and right arrow characters can be "printed" on the screen using the html entities: <b>&amp;lt;</b> for the left arrow, and <b>&amp;gt;</b> for the right arrow.
  2810. <br />
  2811. By converting the left and right arrows to their represented code, they are displayed in the browser as harmless arrows. Since they are no longer actual arrows, but the code equivalent, they no longer pose a threat to your forum. You can then login to your admin panel like normal, and remove the extra code.
  2812. <br /><br />
  2813. If a description contains the left, and or right arrow <b>&lt; &gt;</b>, it will be highlighted in <b>yellow</b>.
  2814. Yellow indicates that these characters, <i>may</i> possibly be used in a harmful way. This is not always the case though; just because the description contains the left or right arrow, does not mean it is insecure or harmful. Many administrators use them by choice on their website, for line breaks <b>&lt;br /&gt;</b>, images <b>&lt;img&gt;</b> and font modifications <b>&lt;font&gt;</b>. I would suggest double checking these descriptions to ensure they contain <b>only</b> what you wrote.
  2815. <br /><br />
  2816. If a description contains any of the other tags, such as the famous <b>iframe</b>, <b>javascript</b> or <b>embed</b> tags, it will be highlighted in <font color="#ff0000"><b>red</b></font>.
  2817. Red indicates that these descriptions almost certainly contain harmful information. Hardly any administrators use these tags in their forum descriptions, but hackers almost <i>always</i> do. Read through the descriptions highlighted in red, and unless you intentionally intended to add that code, sanitize it.
  2818. </td>
  2819. </tr>
  2820. </table>
  2821. </td>
  2822. </tr>
  2823. </table>
  2824. <?php
  2825. //
  2826. // Seperator table
  2827. //
  2828. ?>
  2829. <?php
  2830. ///////////////////////
  2831. //
  2832. // Table for sitedesc
  2833. //
  2834. ///////////////////////
  2835. ?>
  2836. <center>
  2837. <table>
  2838. <table width="95%" border="0" bgcolor="#ffffff" cellspacing="1" cellpadding="3">
  2839. <tr>
  2840. <td>
  2841. <center>
  2842. <table width="100%" border="0" bgcolor="#ffffff" cellspacing="1" cellpadding="3">
  2843. <tr><td width="20%">
  2844. <a name="site_descriptions"><b>Site Description:</b></a>
  2845. </td>
  2846. <td align="center" nowrap>
  2847. &nbsp;
  2848. </td>
  2849. <td align="right" width="10%">
  2850. <a href="<?php echo $_SERVER['PHP_SELF']; ?>">Back</a>
  2851. </td>
  2852. </tr>
  2853. </table>
  2854. <center><table width="100%" style="border:2px solid black;" bgcolor="#f5f5f5" cellspacing="1" cellpadding="3">
  2855. <tr>
  2856. <td bgcolor="#d5d5d5" width="40%" cellpadding="5">
  2857. <div align="center"><b>Description:</b></div>
  2858. </td>
  2859. <td bgcolor="#d5d5d5" width="35%" cellpadding="5">
  2860. <div align="center"><b>Details:</b></div>
  2861. </td>
  2862. <td bgcolor="#d5d5d5" width="10%" cellpadding="5">
  2863. <div align="center"><b>Options:</b></div>
  2864. </td>
  2865. </tr>
  2866. <?php
  2867. //
  2868. // Begin forum description check
  2869. //
  2870. // Specify description badwords
  2871. $desc['badwords']['minor'][] = '<';
  2872. $desc['badwords']['minor'][] = '>';
  2873. $desc['badwords']['major'][] = '<javascript';
  2874. $desc['badwords']['major'][] = 'script>';
  2875. $desc['badwords']['major'][] = '<iframe';
  2876. $desc['badwords']['major'][] = '<frame';
  2877. $desc['badwords']['major'][] = 'iframe>';
  2878. $desc['badwords']['major'][] = 'frame>';
  2879. $desc['badwords']['major'][] = '<embed';
  2880. $desc['badwords']['major'][] = 'embed>';
  2881. // Get forum names and descriptions
  2882. $result = mysql_query("SELECT * FROM $phpbb_config WHERE config_name='site_desc' LIMIT 1");
  2883. $myrow = mysql_fetch_array($result);
  2884. // Assign orig desc to variable
  2885. $desc['orig'] = $myrow['config_value'];
  2886. // Define default variables marking descriptiosn as safe.
  2887. // The if statements will change them if it finds a match
  2888. $desc['status'] = 'green';
  2889. $desc['row_color'] = '45BF10';
  2890. $desc['details'] = 'No malicious information detected.';
  2891. $desc['new'] = safe_desc( $desc['orig'] );
  2892. // Interate through each minor badword
  2893. foreach( $desc['badwords']['minor'] as $word )
  2894. {
  2895. if( stristr( $desc['orig'], $word ) )
  2896. {
  2897. $desc['status'] = 'yellow';
  2898. $desc['row_color'] = 'FFEA00';
  2899. $desc['details'] = '<b>Potentially harmful information detected:</b><br />The left <b>&lt;</b> and/or right <b>&gt;</b> arrow characters have been detected in this description. Many administrators use these for legitimate purposes and it should most likely be left alone.';
  2900. $desc['new'] = ''.safe_desc( $desc['orig'] ).'';
  2901. }
  2902. }
  2903. // Interate through each major badword
  2904. foreach( $desc['badwords']['major'] as $word )
  2905. {
  2906. if( stristr( $desc['orig'], $word ) )
  2907. {
  2908. $desc['status'] = 'red';
  2909. $desc['row_color'] = 'C30000';//C30000';
  2910. $desc['details'] = '<b>Malicious infomration detected:</b><br />One or more of the <b>javascript</b>, <b>iframe</b> or <b>embed</b> tags have been detected in this description. Unless you intentionally added this information yourself, this description should be <b>sanitized</b>.';
  2911. $desc['new'] = '<b>'.safe_desc( $desc['orig'] ).'</b>';
  2912. }
  2913. }
  2914. ?>
  2915. <tr>
  2916. <td bgcolor="#<?php echo $desc['row_color']; ?>" align="left" valign="top"><font face="arial" size="2"><?php echo $desc['new']; ?></font></td>
  2917. <td bgcolor="#c5c5c5" align="left" valign="top"><font face="arial" size="2"><?php echo $desc['details']; ?></font></td>
  2918. <td bgcolor="#e5e5e5" align="center"><?php if( $desc['status'] == 'green' ) { echo '-'; } else { echo '<a href="?mode=security_scan&sanitize=site_desc">Sanitize</a>'; } ?></td>
  2919. </tr>
  2920. <?php
  2921. echo "</table></center>";
  2922. ?>
  2923. </td>
  2924. </tr>
  2925. </table>
  2926. </center>
  2927. <?php
  2928. ///////////////////////
  2929. //
  2930. // Table for site desc
  2931. //
  2932. ///////////////////////
  2933. ?>
  2934. <?php
  2935. ///////////////////////
  2936. //
  2937. // Table for forum desc
  2938. //
  2939. ///////////////////////
  2940. ?>
  2941. <center>
  2942. <table>
  2943. <table width="95%" border="0" bgcolor="#ffffff" cellspacing="1" cellpadding="3">
  2944. <tr>
  2945. <td>
  2946. <center>
  2947. <table width="100%" border="0" bgcolor="#ffffff" cellspacing="1" cellpadding="3">
  2948. <tr><td width="20%">
  2949. <a name="forum_descriptions"><b>Forum Descriptions:</b></a>
  2950. </td>
  2951. <td align="center" nowrap>
  2952. &nbsp;
  2953. </td>
  2954. <td align="right" width="10%">
  2955. <a href="<?php echo $_SERVER['PHP_SELF']; ?>">Back</a>
  2956. </td>
  2957. </tr>
  2958. </table>
  2959. <center><table width="100%" style="border:2px solid black;" bgcolor="#f5f5f5" cellspacing="1" cellpadding="3">
  2960. <tr>
  2961. <td bgcolor="#d5d5d5" width="15" cellpadding="5">
  2962. <div align="center"><b>Forum:</b></div>
  2963. </td>
  2964. <td bgcolor="#d5d5d5" width="40%" cellpadding="5">
  2965. <div align="center"><b>Description:</b></div>
  2966. </td>
  2967. <td bgcolor="#d5d5d5" width="35%" cellpadding="5">
  2968. <div align="center"><b>Details:</b></div>
  2969. </td>
  2970. <td bgcolor="#d5d5d5" width="10%" cellpadding="5">
  2971. <div align="center"><b>Options:</b></div>
  2972. </td>
  2973. </tr>
  2974. <?php
  2975. //
  2976. // Begin forum description check
  2977. //
  2978. // Get forum names and descriptions
  2979. $result = mysql_query("SELECT * FROM $phpbb_forums ORDER BY forum_name ASC");
  2980. while( $myrow = mysql_fetch_array($result) )
  2981. {
  2982. // Assign orig desc to variable
  2983. $desc['orig'] = $myrow['forum_desc'];
  2984. // Define default variables marking descriptiosn as safe.
  2985. // The if statements will change them if it finds a match
  2986. $desc['status'] = 'green';
  2987. $desc['row_color'] = '45BF10';
  2988. $desc['details'] = 'No malicious information detected.';
  2989. $desc['new'] = safe_desc( $desc['orig'] );
  2990. // Interate through each minor badword
  2991. foreach( $desc['badwords']['minor'] as $word )
  2992. {
  2993. if( stristr( $desc['orig'], $word ) )
  2994. {
  2995. $desc['status'] = 'yellow';
  2996. $desc['row_color'] = 'FFEA00';
  2997. $desc['details'] = '<b>Potentially harmful information detected:</b><br />The left <b>&lt;</b> and/or right <b>&gt;</b> arrow characters have been detected in this description. Many administrators use these for legitimate purposes and it should most likely be left alone.';
  2998. $desc['new'] = ''.safe_desc( $desc['orig'] ).'';
  2999. }
  3000. }
  3001. // Interate through each major badword
  3002. foreach( $desc['badwords']['major'] as $word )
  3003. {
  3004. if( stristr( $desc['orig'], $word ) )
  3005. {
  3006. $desc['status'] = 'red';
  3007. $desc['row_color'] = 'C30000';//C30000';
  3008. $desc['details'] = '<b>Malicious infomration detected:</b><br />One or more of the <b>javascript</b>, <b>iframe</b> or <b>embed</b> tags have been detected in this description. Unless you intentionally added this information yourself, this description should be <b>sanitized</b>.';
  3009. $desc['new'] = '<b>'.safe_desc( $desc['orig'] ).'</b>';
  3010. }
  3011. }
  3012. ?>
  3013. <tr>
  3014. <td bgcolor="#c5c5c5"><b><?php echo $myrow['forum_name']; ?></b></td>
  3015. <td bgcolor="#<?php echo $desc['row_color']; ?>" align="left" valign="top"><font face="arial" size="2"><?php echo $desc['new']; ?></font></td>
  3016. <td bgcolor="#c5c5c5" align="left" valign="top"><font face="arial" size="2"><?php echo $desc['details']; ?></font></td>
  3017. <td bgcolor="#e5e5e5" align="center"><?php if( $desc['status'] == 'green' ) { echo '-'; } else { echo '<a href="?mode=security_scan&sanitize='.$myrow['forum_id'].'">Sanitize</a>'; } ?></td>
  3018. </tr>
  3019. <?php
  3020. }
  3021. echo "</table></center>";
  3022. ?>
  3023. </td>
  3024. </tr>
  3025. </table>
  3026. </center>
  3027. <?php
  3028. ///////////////////////
  3029. //
  3030. // Table for forum desc
  3031. //
  3032. ///////////////////////
  3033. ?>
  3034. <?php
  3035. echo $_SESSION['copyrightfooter'];
  3036. } //3.2-2-1
  3037. else
  3038. { //3.2-2-2
  3039. header( "Location: $index ");
  3040. } //3.2-2-2
  3041. } //3.2-2-secutiy_check
  3042. /////////////////////////////////////
  3043. //
  3044. // Check to see if mode=config is set
  3045. //
  3046. /////////////////////////////////////
  3047. elseif( isset($_GET['mode'] ) && $_GET['mode'] == 'config' && $_SESSION['user_level'] == 'admin' )
  3048. { //3.2-1
  3049. // echo 'Would normaly list the Board config page.<br /><a href="'.$_SERVER['PHP_SELF'].'">Back</a>';
  3050. // Orig info from forum: $result = mysql_query("SELECT config_name AS name, config_value AS val FROM $phpbb_config");
  3051. //
  3052. // while ( $myrow = mysql_fetch_assoc($result) )
  3053. // {
  3054. // $name = $myrow['name'];
  3055. // $val = $myrow['val'];
  3056. // $cfg[$name] = $val;
  3057. //
  3058. ///////////////////////////////
  3059. //
  3060. // Begin Grabbing phpbb config
  3061. $result = mysql_query("SELECT * FROM $phpbb_config WHERE config_name='server_name' LIMIT 1");
  3062. $myrow = mysql_fetch_array($result);
  3063. $config_server_name = $myrow['config_value'];
  3064. $result = mysql_query("SELECT * FROM $phpbb_config WHERE config_name='server_port' LIMIT 1");
  3065. $myrow = mysql_fetch_array($result);
  3066. $config_server_port = $myrow['config_value'];
  3067. $result = mysql_query("SELECT * FROM $phpbb_config WHERE config_name='script_path' LIMIT 1");
  3068. $myrow = mysql_fetch_array($result);
  3069. $config_script_path = $myrow['config_value'];
  3070. $result = mysql_query("SELECT * FROM $phpbb_config WHERE config_name='sitename' LIMIT 1");
  3071. $myrow = mysql_fetch_array($result);
  3072. $config_sitename = $myrow['config_value'];
  3073. $result = mysql_query("SELECT * FROM $phpbb_config WHERE config_name='site_desc' LIMIT 1");
  3074. $myrow = mysql_fetch_array($result);
  3075. $config_site_desc = $myrow['config_value'];
  3076. $result = mysql_query("SELECT * FROM $phpbb_config WHERE config_name='board_disable' LIMIT 1");
  3077. $myrow = mysql_fetch_array($result);
  3078. $config_board_disable = $myrow['config_value'];
  3079. $result = mysql_query("SELECT * FROM $phpbb_config WHERE config_name='require_activation' LIMIT 1");
  3080. $myrow = mysql_fetch_array($result);
  3081. $config_require_activation = $myrow['config_value'];
  3082. $result = mysql_query("SELECT * FROM $phpbb_config WHERE config_name='board_email_form' LIMIT 1");
  3083. $myrow = mysql_fetch_array($result);
  3084. $config_board_email_form = $myrow['config_value'];
  3085. $result = mysql_query("SELECT * FROM $phpbb_config WHERE config_name='gzip_compress' LIMIT 1");
  3086. $myrow = mysql_fetch_array($result);
  3087. $config_gzip_compress = $myrow['config_value'];
  3088. $result = mysql_query("SELECT * FROM $phpbb_config WHERE config_name='prune_enable' LIMIT 1");
  3089. $myrow = mysql_fetch_array($result);
  3090. $config_prune_enable = $myrow['config_value'];
  3091. // Begin cookie info
  3092. $result = mysql_query("SELECT * FROM $phpbb_config WHERE config_name='cookie_domain' LIMIT 1");
  3093. $myrow = mysql_fetch_array($result);
  3094. $config_cookie_domain = $myrow['config_value'];
  3095. $result = mysql_query("SELECT * FROM $phpbb_config WHERE config_name='cookie_name' LIMIT 1");
  3096. $myrow = mysql_fetch_array($result);
  3097. $config_cookie_name = $myrow['config_value'];
  3098. $result = mysql_query("SELECT * FROM $phpbb_config WHERE config_name='cookie_path' LIMIT 1");
  3099. $myrow = mysql_fetch_array($result);
  3100. $config_cookie_path = $myrow['config_value'];
  3101. $result = mysql_query("SELECT * FROM $phpbb_config WHERE config_name='cookie_secure' LIMIT 1");
  3102. $myrow = mysql_fetch_array($result);
  3103. $config_cookie_secure = $myrow['config_value'];
  3104. $result = mysql_query("SELECT * FROM $phpbb_config WHERE config_name='session_length' LIMIT 1");
  3105. $myrow = mysql_fetch_array($result);
  3106. $config_session_length = $myrow['config_value'];
  3107. // Begin Email Info
  3108. $result = mysql_query("SELECT * FROM $phpbb_config WHERE config_name='board_email' LIMIT 1");
  3109. $myrow = mysql_fetch_array($result);
  3110. $config_board_email = $myrow['config_value'];
  3111. $result = mysql_query("SELECT * FROM $phpbb_config WHERE config_name='board_email_sig' LIMIT 1");
  3112. $myrow = mysql_fetch_array($result);
  3113. $config_board_email_sig = $myrow['config_value'];
  3114. $result = mysql_query("SELECT * FROM $phpbb_config WHERE config_name='smtp_delivery' LIMIT 1");
  3115. $myrow = mysql_fetch_array($result);
  3116. $config_smtp_delivery = $myrow['config_value'];
  3117. $result = mysql_query("SELECT * FROM $phpbb_config WHERE config_name='smtp_host' LIMIT 1");
  3118. $myrow = mysql_fetch_array($result);
  3119. $config_smtp_host = $myrow['config_value'];
  3120. $result = mysql_query("SELECT * FROM $phpbb_config WHERE config_name='smtp_username' LIMIT 1");
  3121. $myrow = mysql_fetch_array($result);
  3122. $config_smtp_username = $myrow['config_value'];
  3123. $result = mysql_query("SELECT * FROM $phpbb_config WHERE config_name='smtp_password' LIMIT 1");
  3124. $myrow = mysql_fetch_array($result);
  3125. $config_smtp_password = $myrow['config_value'];
  3126. $result = mysql_query("SELECT * FROM $phpbb_config WHERE config_name='default_style' LIMIT 1");
  3127. $myrow = mysql_fetch_array($result);
  3128. $config_default_style = $myrow['config_value'];
  3129. $result = mysql_query("SELECT * FROM $phpbb_config WHERE config_name='override_user_style' LIMIT 1");
  3130. $myrow = mysql_fetch_array($result);
  3131. $config_override_user_style = $myrow['config_value'];
  3132. $result = mysql_query("SELECT * FROM $phpbb_config WHERE `config_name`='board_startdate' LIMIT 1");
  3133. $myrow = mysql_fetch_array($result);
  3134. $board_startdate = $myrow['config_value'];
  3135. ////////////////////////////////////////
  3136. //
  3137. // Begin checks on auto detect settings
  3138. if( isset( $_GET['detect'] ) && $_GET['detect'] == 'general' )
  3139. {
  3140. // Server Name
  3141. $detect_server_name = $HTTP_SERVER_VARS['SERVER_NAME'];
  3142. if ( substr( $detect_server_name, 0, 4 ) == 'www.' )
  3143. {
  3144. $detect_server_name = substr( $detect_server_name, 4 );
  3145. }
  3146. else
  3147. {
  3148. $detect_server_name = $detect_server_name;
  3149. }
  3150. // Server Port
  3151. $detect_server_port = $HTTP_SERVER_VARS['SERVER_PORT'];
  3152. $tmp1_self = $_SERVER['PHP_SELF'];
  3153. $tmp2_self = end(explode('/', $tmp1_self));
  3154. $tmp2_self_size = strlen( $tmp2_self );
  3155. // Script Path
  3156. $detect_script_path = substr( $tmp1_self, 0, -$tmp2_self_size );
  3157. // echo "$tmp1_self<br />$tmp2_self<br />$tmp2_self_size<br />$detect_script_path";
  3158. }
  3159. if( isset( $_GET['detect'] ) && $_GET['detect'] == 'cookie' )
  3160. {
  3161. // Cookie Domain
  3162. $detect_cookie_domain = $HTTP_SERVER_VARS['SERVER_NAME'];
  3163. if ( substr( $detect_cookie_domain, 0, 4 ) == 'www.' )
  3164. {
  3165. $detect_cookie_domain = substr( $detect_cookie_domain, 4 );
  3166. }
  3167. else
  3168. {
  3169. $detect_cookie_domain = $detect_cookie_domain;
  3170. }
  3171. }
  3172. ?>
  3173. <html>
  3174. <head>
  3175. <title>PHPBB Admin ToolKit v<?php echo $_SESSION['toolkitversion']; ?></title>
  3176. </head>
  3177. <body link="#0000ff" vlink="#0000ff" alink="#0000ff">
  3178. <center>
  3179. <table border="0" bgcolor="#ffffff" cellspacing="1" cellpadding="3">
  3180. <tr><td><div align="center"><?php echo $_SESSION['toolkit_title']; ?></div></td></tr>
  3181. </table><br />
  3182. <?php
  3183. // Begin error reporting section
  3184. if( isset( $_SESSION['errors']['config'] ) )
  3185. {
  3186. foreach( $_SESSION['errors']['config'] as $error )
  3187. {
  3188. echo $error;
  3189. echo "<br />\n";
  3190. }
  3191. unset( $_SESSION['errors']['config'] );
  3192. echo "<br />";
  3193. }
  3194. // End error reporting section
  3195. // The Board Config section is currently disabled in this release.<br />
  3196. // Please wait untill beta 4 for a working version.<br /><br />
  3197. ?>
  3198. </center>
  3199. <center>
  3200. <table border="0" width="60%" bgcolor="ffffff" cellpadding="0">
  3201. <tr><td><font size="5"><b>Board Configuration:</a></font></td><td align="right"><a href="<?php echo $_SERVER['PHP_SELF']; ?>">Cancel</a>
  3202. </td></tr>
  3203. </table>
  3204. <table width="60%" style="border:1px solid black;" bgcolor="#000000" cellspacing="1" cellpadding="0">
  3205. <tr>
  3206. <td bgcolor="f5f5f5">
  3207. <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="POST">
  3208. <input type="hidden" name="edit_board_config" value="224">
  3209. <table border="0" bgcolor="#e5e5e5" cellpadding="5" width="100%">
  3210. <tr>
  3211. <td><center><a name="general"><font size="4"><b>General Board Settings:</b></font></a></center></td>
  3212. </tr>
  3213. </table>
  3214. <table border="0" cellpadding="" cellspacing="10">
  3215. <tr>
  3216. <td>Domain Name:</td>
  3217. <td><input type="text" name="server_name" value="<?php echo $config_server_name; ?>" style="border-right: black 1px solid; border-top: black 1px solid; border-left: black 1px solid; border-bottom: black 1px solid" size="35" length="255" maxlength="255"></td>
  3218. <td nowrap><?php
  3219. if( isset( $detect_server_name ) )
  3220. {
  3221. if( $config_server_name != $detect_server_name )
  3222. {
  3223. echo "<font color=\"#ff0000\"><b>$detect_server_name</b></font>";
  3224. }
  3225. else
  3226. {
  3227. echo $detect_server_name;
  3228. }
  3229. }
  3230. else
  3231. {
  3232. ?>( <a href="?mode=config&detect=general">Auto Detect</a> )<?php
  3233. }
  3234. ?></td>
  3235. </tr>
  3236. <tr>
  3237. <td>Port:</td>
  3238. <td><input type="text" name="server_port" value="<?php echo $config_server_port; ?>" style="border-right: black 1px solid; border-top: black 1px solid; border-left: black 1px solid; border-bottom: black 1px solid" size="1" maxlength="3" >
  3239. <td><?php
  3240. if( isset( $detect_server_port ) )
  3241. {
  3242. if( $config_server_port != $detect_server_port )
  3243. {
  3244. echo "<font color=\"#ff0000\"><b>$detect_server_port</b></font>";
  3245. }
  3246. else
  3247. {
  3248. echo $detect_server_port;
  3249. }
  3250. }
  3251. else
  3252. {
  3253. ?>( <a href="?mode=config&detect=general">Auto Detect</a> )<?php
  3254. }
  3255. ?></td>
  3256. </tr>
  3257. <tr>
  3258. <td>Script Path:</td>
  3259. <td><input type="text" name="script_path" value="<?php echo $config_script_path; ?>" style="border-right: black 1px solid; border-top: black 1px solid; border-left: black 1px solid; border-bottom: black 1px solid" size="35" length="255" maxlength="255">
  3260. <td><?php
  3261. if( isset( $detect_script_path ) )
  3262. {
  3263. if( $config_script_path != $detect_script_path )
  3264. {
  3265. echo "<font color=\"#ff0000\"><b>$detect_script_path</b></font>";
  3266. }
  3267. else
  3268. {
  3269. echo $detect_script_path;
  3270. }
  3271. }
  3272. else
  3273. {
  3274. ?>( <a href="?mode=config&detect=general">Auto Detect</a> )<?php
  3275. }
  3276. ?></td>
  3277. </tr>
  3278. <tr>
  3279. <td>Site Name:</td>
  3280. <td><input type="text" name="sitename" value="<?php echo $config_sitename; ?>" style="border-right: black 1px solid; border-top: black 1px solid; border-left: black 1px solid; border-bottom: black 1px solid" size="35" length="255" maxlength="255"></td>
  3281. </tr>
  3282. <tr>
  3283. <td>Site Description:</td>
  3284. <td><input type="text" name="site_desc" value="<?php echo $config_site_desc; ?>" style="border-right: black 1px solid; border-top: black 1px solid; border-left: black 1px solid; border-bottom: black 1px solid" size="35" length="255" maxlength="255"></td>
  3285. </tr>
  3286. <tr>
  3287. <td>Disable Board:</td>
  3288. <td><input type="radio" name="board_disable" value="1"<?php if( $config_board_disable == 1 ) { echo ' checked'; } ?>>Yes&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="radio" name="board_disable" value="0"<?php if( $config_board_disable == 0 ) { echo ' checked'; } ?>>No</td>
  3289. </tr>
  3290. <tr>
  3291. <td>Account Activation:</td>
  3292. <td><input type="radio" name="require_activation" value="0"<?php if( $config_require_activation == 0 ) { echo ' checked'; } ?>>None&nbsp;&nbsp;&nbsp;&nbsp;<input type="radio" name="require_activation" value="1"<?php if( $config_require_activation == 1 ) { echo ' checked'; } ?>>User&nbsp;&nbsp;&nbsp;&nbsp;<input type="radio" name="require_activation" value="2"<?php if( $config_require_activation == 2 ) { echo ' checked'; } ?>>Admin</td>
  3293. </tr>
  3294. <tr>
  3295. <td>Email via Board:</td>
  3296. <td><input type="radio" name="board_email_form" value="1"<?php if( $config_board_email_form == 1 ) { echo ' checked'; } ?>>Yes&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="radio" name="board_email_form" value="0"<?php if( $config_board_email_form == 0 ) { echo ' checked'; } ?>>No</td>
  3297. </tr>
  3298. <tr>
  3299. <td>Enable GZip:</td>
  3300. <td><input type="radio" name="gzip_compress" value="1"<?php if( $config_gzip_compress == 1 ) { echo ' checked'; } ?>>Yes&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="radio" name="gzip_compress" value="0"<?php if( $config_gzip_compress == 0 ) { echo ' checked'; } ?>>No</td>
  3301. </tr>
  3302. <tr>
  3303. <td>Enable Pruning:</td>
  3304. <td><input type="radio" name="prune_enable" value="1"<?php if( $config_prune_enable == 1 ) { echo ' checked'; } ?>>Yes&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="radio" name="prune_enable" value="0"<?php if( $config_prune_enable == 0 ) { echo ' checked'; } ?>>No</td>
  3305. </tr>
  3306. <tr>
  3307. <td>Default Style:</td>
  3308. <td>
  3309. <select name="default_style">
  3310. <?php
  3311. // Begin Style Listings
  3312. $themeresult = mysql_query("SELECT * FROM $phpbb_themes ORDER BY themes_id ASC");
  3313. while( $thememyrow = mysql_fetch_array($themeresult) )
  3314. {
  3315. ?><option value="<?php echo $thememyrow['themes_id']; ?>"<?php if( $config_default_style == $thememyrow['themes_id'] ) { echo ' selected'; } ?>><?php echo $thememyrow['template_name'].' ('.$thememyrow['themes_id'].')'; ?></option><?php
  3316. }
  3317. ?>
  3318. </select>
  3319. </td>
  3320. </tr>
  3321. <tr>
  3322. <td>Override Style:</td>
  3323. <td><input type="radio" name="override_user_style" value="1"<?php if( $config_override_user_style == 1 ) { echo ' checked'; } ?>>Yes&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="radio" name="override_user_style" value="0"<?php if( $config_override_user_style == 0 ) { echo ' checked'; } ?>>No</td>
  3324. </tr>
  3325. <tr>
  3326. <td><a name="reset_subsilver" title="Use this option to reset all the CSS settings for the SubSilver template."><i>Reset SubSilver:</i></a></td>
  3327. <td><input type="radio" name="reset_subsilver" value="1">Yes&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="radio" name="reset_subsilver" value="0" checked>No&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;SubSilver ID: <input type="text" name="reset_subsilver_id" value="1" style="border-right: black 1px solid; border-top: black 1px solid; border-left: black 1px solid; border-bottom: black 1px solid" size="1" /></td>
  3328. </tr>
  3329. <?php
  3330. //
  3331. // Date Section
  3332. //
  3333. $date_joined = $board_startdate;
  3334. $date_joined_ap = date( "a", $date_joined );
  3335. ?>
  3336. <tr>
  3337. <td>Start Date:
  3338. <td>
  3339. <input type="text" name="join_mm" value="<?php echo date( "m", $date_joined ); ?>" style="border-right: black 1px solid; border-top: black 1px solid; border-left: black 1px solid; border-bottom: black 1px solid" size="1" maxlength="2" /> /
  3340. <input type="text" name="join_dd" value="<?php echo date( "d", $date_joined ); ?>" style="border-right: black 1px solid; border-top: black 1px solid; border-left: black 1px solid; border-bottom: black 1px solid" size="1" maxlength="2" /> /
  3341. <input type="text" name="join_yy" value="<?php echo date( "Y", $date_joined ); ?>" style="border-right: black 1px solid; border-top: black 1px solid; border-left: black 1px solid; border-bottom: black 1px solid" size="3" maxlength="4" />
  3342. (mm/dd/yyyy)<br />
  3343. </td>
  3344. </tr>
  3345. <tr>
  3346. <td>&nbsp;</td>
  3347. <td>
  3348. <input type="text" name="join_time_hh" value="<?php echo date( "h", $date_joined ); ?>" style="border-right: black 1px solid; border-top: black 1px solid; border-left: black 1px solid; border-bottom: black 1px solid" size="1" maxlength="2" />h :
  3349. <input type="text" name="join_time_mm" value="<?php echo date( "i", $date_joined ); ?>" style="border-right: black 1px solid; border-top: black 1px solid; border-left: black 1px solid; border-bottom: black 1px solid" size="1"maxlength="2" />m
  3350. <input type="text" name="join_time_ss" value="<?php echo date( "s", $date_joined ); ?>" style="border-right: black 1px solid; border-top: black 1px solid; border-left: black 1px solid; border-bottom: black 1px solid" size="1"maxlength="2" />s
  3351. <select name="join_time_ap">
  3352. <option value="am"<?php if( $date_joined_ap == 'am' ) { echo ' selected'; } ?>>AM</option>
  3353. <option value="pm"<?php if( $date_joined_ap == 'pm' ) { echo ' selected'; } ?>>PM</option>
  3354. </select>
  3355. </td>
  3356. </tr>
  3357. <tr>
  3358. <td>
  3359. &nbsp;
  3360. </td>
  3361. <td>
  3362. <input type="checkbox" name="update_time" />Check to enabled date change
  3363. </td>
  3364. </tr>
  3365. </table>
  3366. </td>
  3367. </tr>
  3368. <tr bgcolor="#f5f5f5">
  3369. <td>
  3370. <table border="0" bgcolor="#e5e5e5" cellpadding="5" width="100%">
  3371. <tr>
  3372. <td><center><font size="4"><b>Cookie Settings:</b></font></center></td>
  3373. </tr>
  3374. </table>
  3375. <table border="0" cellpadding="" cellspacing="10">
  3376. <tr>
  3377. <td>Cookie Domain:</td>
  3378. <td><input type="text" name="cookie_domain" value="<?php echo $config_cookie_domain; ?>" style="border-right: black 1px solid; border-top: black 1px solid; border-left: black 1px solid; border-bottom: black 1px solid" size="15" maxlength="255"></td>
  3379. <td><?php
  3380. if( isset( $detect_cookie_domain ) )
  3381. {
  3382. if( $config_cookie_domain != $detect_cookie_domain )
  3383. {
  3384. echo "<font color=\"#ff0000\"><b>$detect_cookie_domain</b></font>";
  3385. }
  3386. else
  3387. {
  3388. echo $detectcookie_domain;
  3389. }
  3390. }
  3391. else
  3392. {
  3393. ?>( <a href="?mode=config&detect=cookie">Auto Detect</a> )<?php
  3394. }
  3395. ?></td>
  3396. </tr>
  3397. <tr>
  3398. <td>Cookie Name:</td>
  3399. <td><input type="text" name="cookie_name" value="<?php echo $config_cookie_name; ?>" style="border-right: black 1px solid; border-top: black 1px solid; border-left: black 1px solid; border-bottom: black 1px solid" size="15" maxlength="255"></td>
  3400. <td><?php
  3401. if( isset( $detect_cookie_domain ) )
  3402. {
  3403. if( $config_cookie_name != 'phpbb2mysql' )
  3404. {
  3405. echo "<font color=\"#ff0000\"><b>phpbb2mysql</b></font>";
  3406. }
  3407. else
  3408. {
  3409. echo 'phpbb2mysql';
  3410. }
  3411. }
  3412. else
  3413. {
  3414. ?>( <a href="?mode=config&detect=cookie">Auto Detect</a> )<?php
  3415. }
  3416. ?></td>
  3417. </tr>
  3418. <tr>
  3419. <td>Cookie Path:</td>
  3420. <td><input type="text" name="cookie_path" value="<?php echo $config_cookie_path; ?>" style="border-right: black 1px solid; border-top: black 1px solid; border-left: black 1px solid; border-bottom: black 1px solid" size="15" maxlength="255"></td>
  3421. </tr>
  3422. <tr>
  3423. <td>Cookie Secure:</td>
  3424. <td><input type="radio" name="cookie_secure" value="1"<?php if( $config_cookie_secure == 1 ) { echo ' checked'; } ?>>Yes&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="radio" name="cookie_secure" value="0"<?php if( $config_cookie_secure == 0 ) { echo ' checked'; } ?>>No</td>
  3425. </tr>
  3426. <tr>
  3427. <td>Session length:</td>
  3428. <td><input type="text" name="session_length" value="<?php echo $config_session_length; ?>" style="border-right: black 1px solid; border-top: black 1px solid; border-left: black 1px solid; border-bottom: black 1px solid" size="4" maxlength="15"></td>
  3429. </tr>
  3430. </table>
  3431. </td>
  3432. </tr>
  3433. <tr bgcolor="#f5f5f5">
  3434. <td>
  3435. <table border="0" bgcolor="#e5e5e5" cellpadding="5" width="100%">
  3436. <tr>
  3437. <td><center><font size="4"><b>Email Settings:</b></font></center></td>
  3438. </tr>
  3439. </table>
  3440. <table border="0" cellpadding="" cellspacing="10">
  3441. <tr>
  3442. <td>Admin Email:</td>
  3443. <td><input type="text" name="board_email" value="<?php echo $config_board_email; ?>" style="border-right: black 1px solid; border-top: black 1px solid; border-left: black 1px solid; border-bottom: black 1px solid" size="35" maxlength="255"></td>
  3444. </tr>
  3445. <tr>
  3446. <td valign="top">Email Signiture:</td>
  3447. <td><textarea rows="3" cols="26" style="border-right: black 1px solid; border-top: black 1px solid; border-left: black 1px solid; border-bottom: black 1px solid" name="board_email_sig"><?php echo $config_board_email_sig; ?></textarea></td>
  3448. </tr>
  3449. <tr>
  3450. <td>Use SMTP Server:</td>
  3451. <td><input type="radio" name="smtp_delivery" value="1"<?php if( $config_smtp_delivery == 1 ) { echo ' checked'; } ?>>Yes&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="radio" name="smtp_delivery" value="0"<?php if( $config_smtp_delivery == 0 ) { echo ' checked'; } ?>>No</td>
  3452. </tr>
  3453. <tr>
  3454. <td>SMTP Address:</td>
  3455. <td><input type="text" name="smtp_host" value="<?php echo $config_smtp_host; ?>" style="border-right: black 1px solid; border-top: black 1px solid; border-left: black 1px solid; border-bottom: black 1px solid" size="35" maxlength="255"></td>
  3456. </tr>
  3457. <tr>
  3458. <td>SMTP Username:</td>
  3459. <td><input type="text" name="smtp_username" value="<?php echo $config_smtp_username; ?>" style="border-right: black 1px solid; border-top: black 1px solid; border-left: black 1px solid; border-bottom: black 1px solid" size="35" maxlength="255"></td>
  3460. </tr>
  3461. <tr>
  3462. <td>SMTP Password:</td>
  3463. <td><input type="password" name="smtp_password" value="<?php echo $config_smtp_password; ?>" style="border-right: black 1px solid; border-top: black 1px solid; border-left: black 1px solid; border-bottom: black 1px solid" size="35" maxlength="255"></td>
  3464. </tr>
  3465. </table>
  3466. <br /><center><input TYPE="submit" VALUE=" Update "></center><br />
  3467. </form>
  3468. </td>
  3469. </tr>
  3470. </table>
  3471. <table border="0" width="60%" bgcolor="ffffff">
  3472. <tr><td><a href="<?php echo $_SERVER['PHP_SELF']; ?>">Cancel</a></td></tr>
  3473. </table>
  3474. <?php echo $_SESSION['copyrightfooter']; ?>
  3475. </center>
  3476. </body>
  3477. </html>
  3478. <?php
  3479. } //3.2-1
  3480. /////////////////////////////////////
  3481. //
  3482. // Check to see if mode=banlist is set
  3483. //
  3484. /////////////////////////////////////
  3485. elseif( isset($_GET['mode'] ) && $_GET['mode'] == 'banlist' )
  3486. { //3.2-2
  3487. if( $_SESSION['user_level'] == 'admin' || $modban == 'yes' )
  3488. { //3.2-2-1
  3489. // echo '<center><b>This banlist is ONLY listed here to demonstrate what it will look like.<br />The banlist in this version of the toolkit is non-functional and I do not recommend making any changes.<br /><br />';
  3490. $list = "username";
  3491. $order = "ASC";
  3492. if( isset( $_GET['list'] ) && $_GET['list'] == "user_id" )
  3493. { //3.3-3
  3494. $list = "user_id";
  3495. } //3.3-3
  3496. elseif( isset( $_GET['list'] ) && $_GET['list'] == "posts" )
  3497. { //3.3-4
  3498. $list = "user_posts";
  3499. } //3.3-4
  3500. elseif( isset( $_GET['list'] ) && $_GET['list'] == "level" )
  3501. { //3.3-5
  3502. $list = "user_level";
  3503. } //3.3-5
  3504. elseif( isset( $_GET['list'] ) && $_GET['list'] == "active" )
  3505. { //3.3-5
  3506. $list = "user_active";
  3507. } //3.3-5
  3508. elseif( isset( $_GET['list'] ) && $_GET['list'] == "email" )
  3509. { //3.3-5
  3510. $list = "user_email";
  3511. } //3.3-5
  3512. $order = "ASC";
  3513. if( isset( $_GET['order'] ) && $_GET['order'] == "DESC" )
  3514. { //3.3-6
  3515. $order = "DESC";
  3516. } //3.3-6
  3517. if( $order == "ASC" )
  3518. { //3.3-7
  3519. $order = "DESC";
  3520. } //3.3-7
  3521. else
  3522. { //3.3-8
  3523. $order = "ASC";
  3524. } //3.3-8
  3525. if( !isset($_GET['order'] ) && !isset($_GET['list'] ) )
  3526. {
  3527. $list = "username";
  3528. $order = "ASC";
  3529. }
  3530. /////////////////////////////////////////////////////////////////////////////////////////
  3531. //
  3532. // This actually lists the users for the ban list
  3533. //
  3534. /////////////////////////////////////////////////////////////////////////////////////////
  3535. $result = mysql_query("SELECT * FROM $phpbb_users ORDER BY $list $order");
  3536. //
  3537. // Remove Resubmit message
  3538. //
  3539. ?>
  3540. <html>
  3541. <head>
  3542. <title>PHPBB Admin ToolKit v<?php echo $_SESSION['toolkitversion']; ?></title>
  3543. </head>
  3544. <body link="#0000ff" vlink="#0000ff" alink="#0000ff">
  3545. <?php
  3546. echo '<center>';
  3547. echo '<table border="0" bgcolor="#ffffff" cellspacing="1" cellpadding="3">';
  3548. echo '<tr><td>'.$_SESSION['toolkit_title'],'</div></td></tr>';
  3549. echo '<tr><td>Logged in as: <b>'.$_SESSION['user_level'].'</b></td></tr></table>';
  3550. if( isset( $_SESSION['banlist_error'] ) )
  3551. { //3.7-1.1
  3552. echo "<br />\n";
  3553. echo $_SESSION['banlist_error'];
  3554. unset( $_SESSION['banlist_error'] );
  3555. } //3.7-1.1
  3556. echo '</center><br />';
  3557. $showadmin = "<a href=\"?show=admin\">Show only Administrators</a>";
  3558. if( isset( $_GET['show'] ) && $_GET['show'] == "admin" )
  3559. { //3.8
  3560. $showadmin = "<a href=\"?show=all\">Show all Users</a>";
  3561. } //3.8
  3562. $showban = "<a href=\"?show=ban\">Show only banned Users</a>";
  3563. if( isset( $_GET['show'] ) && $_GET['show'] == "ban" )
  3564. { //3.9
  3565. $showban = "<a href=\"?show=all\">Show all Users</a>";
  3566. } //3.9
  3567. $showinactive = "<a href=\"?show=inactive\">Show only Inactive Users</a>";
  3568. if( isset( $_GET['show'] ) && $_GET['show'] == "inactive" )
  3569. { //3.8
  3570. $showinactive = "<a href=\"?show=all\">Show all Users</a>";
  3571. } //3.8
  3572. ?>
  3573. <center>
  3574. <table>
  3575. <table width="95%" border="0" bgcolor="#ffffff" cellspacing="1" cellpadding="3">
  3576. <tr>
  3577. <td>
  3578. <center>
  3579. <table width="100%" border="0" bgcolor="#ffffff" cellspacing="1" cellpadding="3">
  3580. <tr><td width="20%">
  3581. <b>Banned Users:</b>
  3582. </td>
  3583. <td align="center" nowrap>
  3584. <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="POST">
  3585. <input type="text" name="banspecificuser" value=" Enter Username Here" onFocus="if(this.value==' Enter Username Here')this.value='';" style="border-right: black 1px solid; border-top: black 1px solid; border-left: black 1px solid; border-bottom: black 1px solid" size="25" length="25" maxlength="50">&nbsp;&nbsp;<input type="submit" value=" Ban User ">
  3586. </form>
  3587. </td>
  3588. <td align="right" width="10%">
  3589. <a href="<?php echo $_SERVER['PHP_SELF']; ?>">Back</a>
  3590. </td>
  3591. </tr>
  3592. </table>
  3593. <center><table width="100%" style="border:2px solid black;" bgcolor="#f5f5f5" cellspacing="1" cellpadding="3">
  3594. <tr>
  3595. <td bgcolor="#d5d5d5" width="10%" cellpadding="5">
  3596. <div align="center"><b>ID:</b></div>
  3597. </td>
  3598. <td bgcolor="#d5d5d5" width="28%" cellpadding="5">
  3599. <div align="center"><<b>Username:</b></div>
  3600. </td>
  3601. <td bgcolor="#d5d5d5" width="22%" cellpadding="5">
  3602. <div align="center"><b>Email:</b></div>
  3603. </td>
  3604. <td bgcolor="#d5d5d5" width="10%" cellpadding="5">
  3605. <div align="center"><b>Posts:</b></div>
  3606. </td>
  3607. <td bgcolor="#d5d5d5" width="10%" cellpadding="5">
  3608. <div align="center"><b>Level:</b></div>
  3609. </td>
  3610. <td bgcolor="#d5d5d5" width="10%" cellpadding="5">
  3611. <div align="center"><b>Active:</b></div>
  3612. </td>
  3613. <td bgcolor="#d5d5d5" width="10%" cellpadding="5">
  3614. <div align="center">Ban:</div>
  3615. </td>
  3616. </tr>
  3617. <?php
  3618. while( $myrow = mysql_fetch_array($result) )
  3619. { //3.10
  3620. if( $myrow['user_level'] == 0 )
  3621. { //3.10.1
  3622. $userlevel = "User";
  3623. } //3.10.1
  3624. elseif( $myrow['user_level'] == 1 )
  3625. { //3.10.2
  3626. $userlevel = "Admin";
  3627. } //3.10.2
  3628. elseif( $myrow['user_level'] == 2 )
  3629. { //3.10.3
  3630. $userlevel = "Mod";
  3631. } //3.10.3
  3632. if( $myrow['user_active'] == 1 )
  3633. { //3.10.3-1
  3634. $useractive = "Yes";
  3635. } //3.10.3-1
  3636. else
  3637. { //3.10.3-2
  3638. $useractive = "No";
  3639. } //3.10.3-2
  3640. $user_id = $myrow['user_id'];
  3641. $bantable = mysql_query("SELECT * FROM $phpbb_banlist WHERE ban_userid=$user_id");
  3642. $banstat = '-';
  3643. $banrow = mysql_fetch_array($bantable);
  3644. if( isset( $banrow['ban_userid'] ) )
  3645. { //3.10.4
  3646. $banstat = 'Banned';
  3647. if( $_SESSION['user_level'] == "admin" )
  3648. { //3.10.4.1
  3649. if( isset( $_GET['show'] ) )
  3650. { //3.10.4.1.1
  3651. $banstat = '<a href="'.$_SERVER['PHP_SELF'].'?show='.$_GET['show'].'&mode=banlist&unban='.$myrow['user_id'].'">UnBan</a>';
  3652. } //3.10.4.1.1
  3653. else
  3654. { //3.10.4.1.2
  3655. $banstat = '<a href="'.$_SERVER['PHP_SELF'].'?mode=banlist&unban='.$myrow['user_id'].'">UnBan</a>';
  3656. } //3.10.4.1.2
  3657. } //3.10.4.1
  3658. if( $_SESSION['user_level'] == "mod" && $modban == 'yes' )
  3659. { //3.10.4.2
  3660. $banstat = '<a href="'.$_SERVER['PHP_SELF'].'?unban='.$myrow['user_id'].'&mode=banlist">UnBan</a>';
  3661. } //3.10.4.2
  3662. } //3.10.4
  3663. if( $banstat == "-" )
  3664. { //3.10.6.1
  3665. continue;
  3666. } //3.10.6.1
  3667. if( isset( $_GET['show'] ) && $_GET['show'] == "admin" )
  3668. { //3.10.5
  3669. if( $myrow['user_level'] != 1 )
  3670. { //3.10.5.1
  3671. continue;
  3672. } //3.10.5.1
  3673. } //3.10.5
  3674. if( isset( $_GET['show'] ) && $_GET['show'] == "inactive" )
  3675. { //3.10.6-1
  3676. if( $myrow['user_active'] == 1 )
  3677. { //3.10.6-1.1
  3678. continue;
  3679. } //3.10.6-1.1
  3680. } //3.10.6-1
  3681. $useremail = $myrow['user_email'];
  3682. $useremailshort = $useremail;
  3683. if ( strlen( $useremail ) > 17 )
  3684. { //3.10.6.2
  3685. $emaildots = "";
  3686. } //3.10.6.2
  3687. else
  3688. { //3.10.6.2
  3689. $emaildots = "";
  3690. } //3.10.6.2
  3691. ?>
  3692. <tr>
  3693. <td bgcolor="#c5c5c5"><div align="left"><?php echo $myrow['user_id']; ?></div></td>
  3694. <td bgcolor="#e5e5e5"><div align="left"><a href="?user_id=<?php echo $myrow['user_id']; ?>"><?php echo $myrow['username']; ?></a></div></td>
  3695. <td bgcolor="#c5C5c5" nowrap><div align="left"><a href="mailto:<?php echo $useremail; ?>"><?php if( $myrow['user_id'] == -1 ) { echo '<center>-</center>'; } else { ?>&nbsp;<?php echo $useremailshort; echo $emaildots; } ?></a></div></td>
  3696. <td bgcolor="#e5e5e5"><div align="right"><?php echo $myrow['user_posts']; ?></div></td>
  3697. <td bgcolor="#c5C5c5"><div align="right"><?php echo $userlevel; ?></div></td>
  3698. <td bgcolor="#e5e5E5"><div align="center"><?php echo $useractive; ?></div></td>
  3699. <td bgcolor="#c5C5c5"><div align="center"><?php echo $banstat; ?></div></td>
  3700. </tr>
  3701. <?php
  3702. } //3.10
  3703. echo "</table></center>";
  3704. $result = mysql_query("SELECT * FROM $phpbb_banlist ORDER BY ban_email ASC");
  3705. ?>
  3706. <br /><br />
  3707. <center>
  3708. <table width="100%" border="0" bgcolor="#ffffff" cellspacing="1" cellpadding="3">
  3709. <tr><td width="20%">
  3710. <b>Banned Emails:</b>
  3711. </td>
  3712. <td align="center" nowrap>
  3713. <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="POST">
  3714. <input type="text" name="banspecificemail" value=" Enter Email Address Here" onFocus="if(this.value==' Enter Email Address Here')this.value='';" style="border-right: black 1px solid; border-top: black 1px solid; border-left: black 1px solid; border-bottom: black 1px solid" size="25" length="25" maxlength="50">&nbsp;&nbsp;<input type="submit" value=" Ban Email ">
  3715. </form>
  3716. </td>
  3717. <td width="10%">
  3718. <div align="right">&nbsp;</div>
  3719. </td>
  3720. </tr>
  3721. </table>
  3722. <table width="100%" style="border:2px solid black;" bgcolor="#f5f5f5" cellspacing="1" cellpadding="3">
  3723. <tr>
  3724. <td bgcolor="#d5d5d5" width="10%" cellpadding="5">
  3725. <div align="center"><font color="#000000"><b>Ban_Id:</b></font></div>
  3726. </td>
  3727. <td bgcolor="#d5d5d5" width="80%" cellpadding="5">
  3728. <div align="center"><font color="#000000"><b>Ban_Email:</b></font></div>
  3729. </td>
  3730. <td bgcolor="#d5d5d5" width="10%" cellpadding="5">
  3731. <div align="center"><font color="#000000"><b>Unban:</b></font></div>
  3732. </td>
  3733. </tr>
  3734. <?php
  3735. while( $myrow = mysql_fetch_array($result) )
  3736. { // 3.10-1-1
  3737. if( isset( $myrow['ban_email'] ) )
  3738. { // 3.10-1-1.1
  3739. ?>
  3740. <tr>
  3741. <td bgcolor="#e5e5E5"><div align="center"><?php echo $myrow['ban_id']; ?></div></td>
  3742. <td bgcolor="#c5C5c5"><div align="center"><?php echo $myrow['ban_email']; ?></div></td>
  3743. <td bgcolor="#e5e5E5"><div align="center"><a href="<?php echo $_SERVER['PHP_SELF']; ?>?unban_banlist=<?php echo $myrow['ban_id']; ?>">Unban</a></div></td>
  3744. </tr>
  3745. <?php
  3746. } // 3.10-1-1.1
  3747. } // 3.10-1-1
  3748. ?>
  3749. </table>
  3750. <table width="100%" border="0" cellpadding="3" cellspacing="1">
  3751. <tr>
  3752. <td align="right">
  3753. <a href="<?php echo $_SERVER['PHP_SELF']; ?>">Back</a>
  3754. </td>
  3755. </tr>
  3756. </table>
  3757. <?php echo $_SESSION['copyrightfooter']; ?>
  3758. </table>
  3759. </center>
  3760. <?php
  3761. } //3.2-2-1
  3762. else
  3763. { //3.2-2-2
  3764. header( "Location: $index ");
  3765. } //3.2-2-2
  3766. } //3.2-2
  3767. elseif( isset( $_POST['massuseraction'] ) )
  3768. { //3.2-2a
  3769. if( !isset( $_POST['user'] ) && !isset( $_POST['export_all'] ) )
  3770. {
  3771. $_SESSION['errors']['index'][] = 'You must select at least one user.';
  3772. header( "Location: $index" );
  3773. exit();
  3774. }
  3775. if( !isset( $_POST['export_selected'] ) && !isset( $_POST['export_all'] ) && !isset( $_POST['delete_users'] ) && $_POST['massuseraction'] != '---')
  3776. { //3.2-2a.1
  3777. //////////////////////////////////////
  3778. //
  3779. // Begin banning multiple users
  3780. if( $_POST['massuseraction'] == 'ban' && ( $_SESSION['user_level'] == 'admin' || $modban == 'yes' ) )
  3781. {
  3782. foreach( $_POST['user'] as $user_id )
  3783. {
  3784. if( $user_id == -1 )
  3785. {
  3786. continue;
  3787. }
  3788. mysql_query("INSERT INTO $phpbb_banlist (ban_userid) VALUES ('$user_id')");
  3789. mysql_query("UPDATE $phpbb_sessions SET session_logged_in=0 WHERE session_user_id=$user_id");
  3790. header( "Location: $index" );
  3791. }
  3792. header( "Location: $index" );
  3793. exit();
  3794. }
  3795. //////////////////////////////////////
  3796. //
  3797. // Begin unbanning multiple users
  3798. elseif( $_POST['massuseraction'] == 'unban' && ( $_SESSION['user_level'] == 'admin' || $modban == 'yes' ) )
  3799. {
  3800. foreach( $_POST['user'] as $user_id )
  3801. {
  3802. $result = mysql_query("SELECT * FROM $phpbb_banlist WHERE ban_userid='$user_id'");
  3803. $myrow = mysql_fetch_array($result);
  3804. if( isset( $myrow['ban_userid'] ) )
  3805. {
  3806. // echo 'User found';
  3807. mysql_query("DELETE FROM $phpbb_banlist WHERE ban_userid=$user_id");
  3808. header( "Location: $index" );
  3809. }
  3810. }
  3811. header( "Location: $index" );
  3812. exit();
  3813. }
  3814. //////////////////////////////////////
  3815. //
  3816. // Begin activating multiple users
  3817. elseif( $_POST['massuseraction'] == 'activate' )
  3818. {
  3819. foreach( $_POST['user'] as $user_id )
  3820. {
  3821. if( $user_id == -1 )
  3822. {
  3823. continue;
  3824. }
  3825. mysql_query("UPDATE $phpbb_users SET user_active='1' WHERE user_id=$user_id");
  3826. header( "Location: $index" );
  3827. }
  3828. header( "Location: $index" );
  3829. exit();
  3830. }
  3831. //////////////////////////////////////
  3832. //
  3833. // Begin Post Count Resync
  3834. elseif( $_POST['massuseraction'] == 'resync' && ( $_SESSION['user_level'] == 'admin' || ( $_SESSION['user_level'] == 'mod' && $modpost == 'yes' ) ) )
  3835. {
  3836. foreach( $_POST['user'] as $user_id )
  3837. {
  3838. $result = mysql_query("SELECT * FROM $phpbb_users WHERE user_id=$user_id");
  3839. $myrow = mysql_fetch_array($result);
  3840. $user_post_count_result = mysql_query("SELECT * FROM $phpbb_posts WHERE poster_id=$user_id");
  3841. $user_post_count = mysql_num_rows($user_post_count_result);
  3842. mysql_query("UPDATE $phpbb_users SET user_posts='$user_post_count' WHERE user_id=$user_id");
  3843. }
  3844. header( "Location: $index" );
  3845. exit();
  3846. }
  3847. //////////////////////////////////////
  3848. //
  3849. // Begin deactivating multiple users
  3850. elseif( $_POST['massuseraction'] == 'deactivate' )
  3851. {
  3852. foreach( $_POST['user'] as $user_id )
  3853. {
  3854. mysql_query("UPDATE $phpbb_users SET user_active='0' WHERE user_id=$user_id");
  3855. header( "Location: $index" );
  3856. }
  3857. header( "Location: $index" );
  3858. exit();
  3859. }
  3860. //////////////////////////////////////
  3861. //
  3862. // Begin deactivating and drop key on multiple users
  3863. elseif( $_POST['massuseraction'] == 'deactivate_and_drop' )
  3864. {
  3865. foreach( $_POST['user'] as $user_id )
  3866. {
  3867. mysql_query("UPDATE $phpbb_users SET user_active='0' WHERE user_id=$user_id");
  3868. mysql_query("UPDATE $phpbb_users SET user_actkey='' WHERE user_id=$user_id");
  3869. header( "Location: $index" );
  3870. }
  3871. header( "Location: $index" );
  3872. exit();
  3873. }
  3874. //////////////////////////////////////
  3875. //
  3876. // Begin clearing signiture
  3877. elseif( $_POST['massuseraction'] == 'clear_sig' )
  3878. {
  3879. foreach( $_POST['user'] as $user_id )
  3880. {
  3881. mysql_query("UPDATE $phpbb_users SET user_sig='' WHERE user_id=$user_id");
  3882. header( "Location: $index" );
  3883. }
  3884. header( "Location: $index" );
  3885. exit();
  3886. }
  3887. //////////////////////////////////////
  3888. //
  3889. // Begin clearing website
  3890. elseif( $_POST['massuseraction'] == 'clear_website' )
  3891. {
  3892. foreach( $_POST['user'] as $user_id )
  3893. {
  3894. mysql_query("UPDATE $phpbb_users SET user_website='' WHERE user_id=$user_id");
  3895. header( "Location: $index" );
  3896. }
  3897. header( "Location: $index" );
  3898. exit();
  3899. }
  3900. //////////////////////////////////////
  3901. //
  3902. // Begin promoting multiple users to admin
  3903. elseif( $_POST['massuseraction'] == 'admin' && $_SESSION['user_level'] == 'admin' )
  3904. {
  3905. if( !isset( $_POST['confirm'] ) || $_POST['confirm'] != 'yes' )
  3906. {
  3907. $_SESSION['errors']['index'][] = 'You must confirm before promoting multiple users to admin.';
  3908. header( "Location: $index" );
  3909. die();
  3910. }
  3911. foreach( $_POST['user'] as $user_id )
  3912. {
  3913. $result = mysql_query("SELECT * FROM $phpbb_users WHERE user_id='$user_id'");
  3914. $myrow = mysql_fetch_array($result);
  3915. if( $user_id == -1 || $myrow['user_level'] == 2 )
  3916. {
  3917. continue;
  3918. }
  3919. mysql_query("UPDATE $phpbb_users SET user_level='1' WHERE user_id=$user_id");
  3920. header( "Location: $index" );
  3921. }
  3922. header( "Location: $index" );
  3923. exit();
  3924. }
  3925. //////////////////////////////////////
  3926. //
  3927. // Begin demoting multiple users to user
  3928. elseif( $_POST['massuseraction'] == 'user' && $_SESSION['user_level'] == 'admin')
  3929. {
  3930. foreach( $_POST['user'] as $user_id )
  3931. {
  3932. $result = mysql_query("SELECT * FROM $phpbb_users WHERE user_id='$user_id'");
  3933. $myrow = mysql_fetch_array($result);
  3934. if( $user_id == -1 || $myrow['user_level'] == 2 )
  3935. {
  3936. continue;
  3937. }
  3938. mysql_query("UPDATE $phpbb_users SET user_level='0' WHERE user_id=$user_id");
  3939. header( "Location: $index" );
  3940. }
  3941. header( "Location: $index" );
  3942. exit();
  3943. }
  3944. else
  3945. {
  3946. header( "Location: $index" );
  3947. exit();
  3948. }
  3949. } //3.2-2a.1
  3950. elseif( ( isset( $_POST['delete_users'] ) || $_POST['delete_confirm'] != '' ) && ( $_SESSION['user_level'] == 'admin' || ( $_SESSION['user_level'] == 'mod' && $moddelete == 'yes' ) ) )
  3951. { //3.2-2a.1-2
  3952. //////////////////////////////////////
  3953. //
  3954. // Begin deleting multiple users
  3955. // Check to make sure the delete confirmation was typed correctly
  3956. if( $_POST['delete_confirm'] != 'delete' )
  3957. {
  3958. $_SESSION['errors']['edituser'][] = 'The word "delete" was not typed correctly.<br />The user(s) have NOT been deleted.';
  3959. header( "Location: $index ");
  3960. exit();
  3961. }
  3962. // Set default delete options
  3963. $clear_posts = false;
  3964. $retain_pms = false;
  3965. // Set delete options for the delete_user function
  3966. if( isset( $_POST['clear_posts'] ) )
  3967. {
  3968. $clear_posts = true;
  3969. }
  3970. if( isset( $_POST['retain_pms'] ) )
  3971. {
  3972. $retain_pms = true;
  3973. }
  3974. delete_user( $_POST['user'], $clear_posts, $retain_pms, 'index' ) ||
  3975. die( 'Error calling the delete_user() function on line: '.__LINE__.'<br />This is not supposed to happen. Please contact starfoxtj.' );
  3976. header( "Location: $index" );
  3977. die();
  3978. } //3.2-2a.1-2
  3979. elseif( isset( $_POST['change_date'] ) && $_SESSION['user_level'] == 'admin' )
  3980. { //3.2-2a.1-3
  3981. if( !isset( $_POST['confirm_date'] ) )
  3982. {
  3983. $_SESSION['errors']['edituser'][] = 'You must confirm when changing the join date for multiple users.';
  3984. header( "Location: $index ");
  3985. exit();
  3986. }
  3987. foreach( $_POST['user'] as $user_id )
  3988. {
  3989. //////////////////////////////////////
  3990. //
  3991. // Begin date change on multiple users
  3992. // Set User ID
  3993. // Create array to pass to make_time with date info
  3994. $time['mm'] = $_POST['join_mm'];
  3995. $time['dd'] = $_POST['join_dd'];
  3996. $time['yy'] = $_POST['join_yy'];
  3997. $time['time_hh'] = $_POST['join_time_hh'];
  3998. $time['time_mm'] = $_POST['join_time_mm'];
  3999. $time['time_ss'] = $_POST['join_time_ss'];
  4000. $time['time_ap'] = $_POST['join_time_ap'];
  4001. // Obtain timestamp from make_time, send back to edit user with error if returns false
  4002. if( $timestamp = make_time( $time ) )
  4003. {
  4004. // Generate SQL query
  4005. $sql = "UPDATE `$phpbb_users` SET `user_regdate`=$timestamp WHERE `user_id`=$user_id";
  4006. if( !$result = mysql_query( $sql ) )
  4007. {
  4008. die( '<font size="4"><b>Error updating user\'s join date:</b></font><br /><b>Line:</b> '.__LINE__.'<br /><b>File:</b> '.$_SERVER['PHP_SELF']."<br /><b>Query:</b> $sql<br /><b>MySQL Error:</b> ".mysql_error() );
  4009. }
  4010. }
  4011. else
  4012. {
  4013. foreach( $_SESSION['errors']['make_time'] as $error )
  4014. {
  4015. $_SESSION['errors']['index'][] = $error;
  4016. }
  4017. unset( $_SESSION['errors']['make_time'] );
  4018. }
  4019. }
  4020. header( "Location: $index" );
  4021. die();
  4022. } //3.2-2a.1-3
  4023. /////////////////////////////////////
  4024. //
  4025. // Begin Exporting Users
  4026. //
  4027. elseif( isset( $_POST['export_selected'] ) || isset( $_POST['export_all'] ) && $_SESSION['user_level'] == 'admin' )
  4028. { //3.2-2a.2
  4029. // We'll be outputting a CSV
  4030. header('Content-type: application/octetstream');
  4031. header('Content-type: application/octet-stream');
  4032. //did the above to make sure that all browsers see it as such. (yes, IE needs diffrent ones)
  4033. header("Content-Disposition: attachment; filename=AddressBook.csv");
  4034. if( $_POST['export_type'] == 'email_only' )
  4035. { //3.2-2a.2.1
  4036. if( isset( $_POST['export_all'] ) )
  4037. {
  4038. $result = mysql_query("SELECT * FROM $phpbb_users ORDER BY user_email ASC");
  4039. while($myrow = mysql_fetch_array($result))
  4040. {
  4041. $user_id = $myrow['user_id'];
  4042. if( $user_id == -1 )
  4043. {
  4044. continue;
  4045. }
  4046. echo $myrow['user_email']."\n";
  4047. }
  4048. }
  4049. else
  4050. {
  4051. foreach( $_POST['user'] as $user_id )
  4052. {
  4053. if( $user_id == -1 )
  4054. {
  4055. continue;
  4056. }
  4057. $result = mysql_query("SELECT * FROM $phpbb_users WHERE user_id=$user_id");
  4058. $myrow = mysql_fetch_array($result);
  4059. echo $myrow['user_email']."\n";
  4060. }
  4061. }
  4062. } //3.2-2a.2.1
  4063. elseif( $_POST['export_type'] == 'gmail_csv' )
  4064. { //3.2-2a.2.2
  4065. echo "Name,Email\n";
  4066. if( isset( $_POST['export_all'] ) )
  4067. {
  4068. $result = mysql_query("SELECT * FROM $phpbb_users ORDER BY username ASC");
  4069. while($myrow = mysql_fetch_array($result))
  4070. {
  4071. $user_id = $myrow['user_id'];
  4072. if( $user_id == -1 )
  4073. {
  4074. continue;
  4075. }
  4076. $username = $myrow['username'];
  4077. $username = str_replace( "&amp;", "&", $username );
  4078. $username = str_replace( "&lt;", "<", $username );
  4079. $username = str_replace( "&gt;", ">", $username );
  4080. echo $username.','.$myrow['user_email']."\n";
  4081. }
  4082. }
  4083. else
  4084. {
  4085. foreach( $_POST['user'] as $user_id )
  4086. {
  4087. if( $user_id == -1 )
  4088. {
  4089. continue;
  4090. }
  4091. $result = mysql_query("SELECT * FROM $phpbb_users WHERE user_id=$user_id");
  4092. $myrow = mysql_fetch_array($result);
  4093. $username = $myrow['username'];
  4094. $username = str_replace( "&amp;", "&", $username );
  4095. $username = str_replace( "&lt;", "<", $username );
  4096. $username = str_replace( "&gt;", ">", $username );
  4097. echo $username.','.$myrow['user_email']."\n";
  4098. }
  4099. }
  4100. } //3.2-2a.2.2
  4101. elseif( $_POST['export_type'] == 'hotmail_csv' )
  4102. { //3.2-2a.2.3
  4103. echo "First Name,Last Name,E-mail Address\n";
  4104. if( isset( $_POST['export_all'] ) )
  4105. {
  4106. $result = mysql_query("SELECT * FROM $phpbb_users ORDER BY username ASC");
  4107. while($myrow = mysql_fetch_array($result))
  4108. {
  4109. $user_id = $myrow['user_id'];
  4110. if( $user_id == -1 )
  4111. {
  4112. continue;
  4113. }
  4114. $username = $myrow['username'];
  4115. $username = str_replace( "&amp;", "&", $username );
  4116. $username = str_replace( "&lt;", "<", $username );
  4117. $username = str_replace( "&gt;", ">", $username );
  4118. echo $username.',,'.$myrow['user_email']."\n";
  4119. }
  4120. }
  4121. else
  4122. {
  4123. foreach( $_POST['user'] as $user_id )
  4124. {
  4125. if( $user_id == -1 )
  4126. {
  4127. continue;
  4128. }
  4129. $result = mysql_query("SELECT * FROM $phpbb_users WHERE user_id=$user_id");
  4130. $myrow = mysql_fetch_array($result);
  4131. $username = $myrow['username'];
  4132. $username = str_replace( "&amp;", "&", $username );
  4133. $username = str_replace( "&lt;", "<", $username );
  4134. $username = str_replace( "&gt;", ">", $username );
  4135. echo $username.',,'.$myrow['user_email']."\n";
  4136. }
  4137. }
  4138. } //3.2-2a.2.3
  4139. elseif( $_POST['export_type'] == 'yahoo_csv' )
  4140. { //3.2-2a.2.4
  4141. echo "First,Email\n";
  4142. if( isset( $_POST['export_all'] ) )
  4143. {
  4144. $result = mysql_query("SELECT * FROM $phpbb_users ORDER BY username ASC");
  4145. while($myrow = mysql_fetch_array($result))
  4146. {
  4147. $user_id = $myrow['user_id'];
  4148. if( $user_id == -1 )
  4149. {
  4150. continue;
  4151. }
  4152. $username = $myrow['username'];
  4153. $username = str_replace( "&amp;", "&", $username );
  4154. $username = str_replace( "&lt;", "<", $username );
  4155. $username = str_replace( "&gt;", ">", $username );
  4156. echo $username.','.$myrow['user_email']."\n";
  4157. }
  4158. }
  4159. else
  4160. {
  4161. foreach( $_POST['user'] as $user_id )
  4162. {
  4163. if( $user_id == -1 )
  4164. {
  4165. continue;
  4166. }
  4167. $result = mysql_query("SELECT * FROM $phpbb_users WHERE user_id=$user_id");
  4168. $myrow = mysql_fetch_array($result);
  4169. $username = $myrow['username'];
  4170. $username = str_replace( "&amp;", "&", $username );
  4171. $username = str_replace( "&lt;", "<", $username );
  4172. $username = str_replace( "&gt;", ">", $username );
  4173. echo $username.','.$myrow['user_email']."\n";
  4174. }
  4175. }
  4176. } //3.2-2a.2.4
  4177. elseif( $_POST['export_type'] == 'outlook_csv' )
  4178. { //3.2-2a.2.5
  4179. echo '"Title","First Name","Middle Name","Last Name","Suffix","Company","Department","Job Title","Business Street","Business Street 2","Business Street 3","Business City","Business State","Business Postal Code","Business Country","Home Street","Home Street 2","Home Street 3","Home City","Home State","Home Postal Code","Home Country","Other Street","Other Street 2","Other Street 3","Other City","Other State","Other Postal Code","Other Country","Assistant\'s Phone","Business Fax","Business Phone","Business Phone 2","Callback","Car Phone","Company Main Phone","Home Fax","Home Phone","Home Phone 2","ISDN","Mobile Phone","Other Fax","Other Phone","Pager","Primary Phone","Radio Phone","TTY/TDD Phone","Telex","Account","Anniversary","Assistant\'s Name","Billing Information","Birthday","Categories","Children","E-mail Address","E-mail Display Name","E-mail 2 Address","E-mail 2 Display Name","E-mail 3 Address","E-mail 3 Display Name","Gender","Government ID Number","Hobby","Initials","Keywords","Language","Location","Mileage","Notes","Office Location","Organizational ID Number","PO Box","Private","Profession","Referred By","Spouse","User 1","User 2","User 3","User 4","Web Page"'."\n";
  4180. if( isset( $_POST['export_all'] ) )
  4181. {
  4182. $result = mysql_query("SELECT * FROM $phpbb_users ORDER BY username ASC");
  4183. while($myrow = mysql_fetch_array($result))
  4184. {
  4185. $user_id = $myrow['user_id'];
  4186. if( $user_id == -1 )
  4187. {
  4188. continue;
  4189. }
  4190. $username = $myrow['username'];
  4191. $username = str_replace( "&amp;", "&", $username );
  4192. $username = str_replace( "&lt;", "<", $username );
  4193. $username = str_replace( "&gt;", ">", $username );
  4194. echo '"","'.$username.'","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","Unfiled","","'.$myrow['user_email'].'","","","","","","","","","","","","","","","","","","","","","","","","","",""'.''."\n";
  4195. }
  4196. }
  4197. else
  4198. {
  4199. foreach( $_POST['user'] as $user_id )
  4200. {
  4201. if( $user_id == -1 )
  4202. {
  4203. continue;
  4204. }
  4205. $result = mysql_query("SELECT * FROM $phpbb_users WHERE user_id=$user_id");
  4206. $myrow = mysql_fetch_array($result);
  4207. $username = $myrow['username'];
  4208. $username = str_replace( "&amp;", "&", $username );
  4209. $username = str_replace( "&lt;", "<", $username );
  4210. $username = str_replace( "&gt;", ">", $username );
  4211. echo '"","'.$username.'","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","Unfiled","","'.$myrow['user_email'].'","","","","","","","","","","","","","","","","","","","","","","","","","",""'.''."\n";
  4212. }
  4213. }
  4214. } //3.2-2a.2.5
  4215. elseif( $_POST['export_type'] == '1&1_newsletter_csv' )
  4216. { //3.2-2a.2.6
  4217. echo '"Company","Title","First name","Last name","Address","Address (additional info)","Country","State","Zip code","City","Phone","Fax","Cell phone","E-mail","Sales tax","Customer number","Customer group","Discount level","Additional information 1","Additional information 2","Additional information 3","Additional information 4","Additional information 5"'."\n";
  4218. if( isset( $_POST['export_all'] ) )
  4219. {
  4220. $result = mysql_query("SELECT * FROM $phpbb_users ORDER BY username ASC");
  4221. while($myrow = mysql_fetch_array($result))
  4222. {
  4223. $user_id = $myrow['user_id'];
  4224. if( $user_id == -1 )
  4225. {
  4226. continue;
  4227. }
  4228. $username = $myrow['username'];
  4229. $username = str_replace( "&amp;", "&", $username );
  4230. $username = str_replace( "&lt;", "<", $username );
  4231. $username = str_replace( "&gt;", ">", $username );
  4232. echo '"","","'.$username.'","'.$username.'","","","","","","","","","","'.$myrow['user_email'].'","","'.$myrow['user_id'].'","","","","","","",""'."\n";
  4233. }
  4234. }
  4235. else
  4236. {
  4237. foreach( $_POST['user'] as $user_id )
  4238. {
  4239. if( $user_id == -1 )
  4240. {
  4241. continue;
  4242. }
  4243. $result = mysql_query("SELECT * FROM $phpbb_users WHERE user_id=$user_id");
  4244. $myrow = mysql_fetch_array($result);
  4245. $username = $myrow['username'];
  4246. $username = str_replace( "&amp;", "&", $username );
  4247. $username = str_replace( "&lt;", "<", $username );
  4248. $username = str_replace( "&gt;", ">", $username );
  4249. echo '"","","'.$username.'","'.$username.'","","","","","","","","","","'.$myrow['user_email'].'","","'.$myrow['user_id'].'","","","","","","",""'."\n";
  4250. }
  4251. }
  4252. } //3.2-2a.2.6
  4253. } //3.2-2a.2
  4254. else
  4255. { //3.2-2a.3
  4256. header( "Location: $index" );
  4257. exit();
  4258. } //3.2-2a.3
  4259. } //3.2-2a
  4260. ////////////////////////////////////////////////////////////////
  4261. //
  4262. // Check to see how to list the users, and define list variables
  4263. //
  4264. ////////////////////////////////////////////////////////////////
  4265. else
  4266. { //3.3
  4267. //
  4268. // Begin Set session info if not already set
  4269. //
  4270. if( !isset( $_SESSION['show'] ) )
  4271. {
  4272. $_SESSION['show'] = "all";
  4273. }
  4274. if( !isset( $_SESSION['show_ban'] ) )
  4275. {
  4276. $_SESSION['show_ban'] = false;
  4277. }
  4278. if( !isset( $_SESSION['list'] ) )
  4279. {
  4280. $_SESSION['list'] = 'username';
  4281. }
  4282. if( !isset( $_SESSION['order'] ) )
  4283. {
  4284. $_SESSION['order'] = "ASC";
  4285. }
  4286. if( !isset( $_SESSION['fullemail'] ) )
  4287. {
  4288. $_SESSION['fullemail'] = "full";
  4289. }
  4290. if( !isset( $_SESSION['search'] ) )
  4291. {
  4292. $_SESSION['search'] = '';
  4293. }
  4294. //
  4295. // Begin Set session info if is set via get
  4296. //
  4297. if( isset( $_GET['list'] ) && isset( $_GET['order'] ) )
  4298. {
  4299. $_SESSION['list'] = $_GET['list'];
  4300. $_SESSION['order'] = $_GET['order'];
  4301. }
  4302. if( isset( $_GET['search'] ) )
  4303. {
  4304. $_SESSION['search'] = $_GET['search'];
  4305. }
  4306. if( isset( $_POST['search_by'] ) )
  4307. {
  4308. $_SESSION['search_by'] = $_POST['search_by'];
  4309. $_SESSION['fullemail'] = 'full';
  4310. }
  4311. //
  4312. // Begin Set session info if is set via post
  4313. //
  4314. if( isset( $_POST['show'] ) )
  4315. {
  4316. $_SESSION['start'] = 0;
  4317. if( $_POST['show'] == 'banned' )
  4318. {
  4319. $_SESSION['show_ban'] = true;
  4320. $_SESSION['show'] = '';
  4321. $_SESSION['show_ban_marker'] = 1;
  4322. }
  4323. else
  4324. {
  4325. $_SESSION['show'] = $_POST['show'];
  4326. $_SESSION['show_ban'] = false;
  4327. }
  4328. }
  4329. if( isset( $_POST['list'] ) )
  4330. {
  4331. $_SESSION['list'] = $_POST['list'];
  4332. }
  4333. if( isset( $_POST['order'] ) )
  4334. {
  4335. $_SESSION['order'] = $_POST['order'];
  4336. }
  4337. if( isset( $_POST['fullemail'] ) )
  4338. {
  4339. $_SESSION['fullemail'] = $_POST['fullemail'];
  4340. }
  4341. if( !isset( $_SESSION['limit'] ) || !isset( $_SESSION['limit_num'] ) )
  4342. {
  4343. $_SESSION['limit'] = ', 25';
  4344. $_SESSION['limit_num'] = 25;
  4345. }
  4346. elseif( isset( $_POST['limit_num'] ) )
  4347. { //3.3--1
  4348. $row_result = mysql_query("SELECT * FROM $phpbb_users");
  4349. $row_count = mysql_num_rows($row_result);
  4350. if( $_SESSION['show_ban'] == true )
  4351. {
  4352. $_SESSION['limit'] = ', '.$row_count;
  4353. $_SESSION['limit_num'] = $row_count;
  4354. }
  4355. else
  4356. { //3.3--2
  4357. if( $_POST['limit_num'] == 'all' )
  4358. {
  4359. $_SESSION['limit'] = ', '.$row_count;
  4360. $_SESSION['limit_num'] = $row_count;
  4361. }
  4362. else
  4363. {
  4364. $_SESSION['limit'] = ', '.$_POST['limit_num'];
  4365. $_SESSION['limit_num'] = $_POST['limit_num'];
  4366. }
  4367. } //3.3--2
  4368. } //3.3--1
  4369. if( isset( $_POST['limit_num'] ) && isset( $_SESSION['show_ban_marker'] ) && $_SESSION['show_ban'] == false && $_SESSION['show_ban_marker'] == 1 )
  4370. {
  4371. $_SESSION['show_ban_marker'] = 0;
  4372. $_SESSION['limit'] = ', 25';
  4373. $_SESSION['limit_num'] = 25;
  4374. }
  4375. if( !isset( $_SESSION['start'] ) )
  4376. {
  4377. $_SESSION['start'] = 0;
  4378. }
  4379. elseif( isset( $_GET['start'] ) )
  4380. {
  4381. $_SESSION['start'] = $_GET['start'];
  4382. }
  4383. if( !isset( $_SESSION['search_by'] ) )
  4384. {
  4385. $_SESSION['search_by'] = 'username';
  4386. }
  4387. $search_by = $_SESSION['search_by'];
  4388. if( $_SESSION['search'] != '' && $_SESSION['show'] != 'all' )
  4389. {
  4390. $query = $_SESSION['search'];
  4391. $search_query = " AND $search_by LIKE '%$query%'";
  4392. }
  4393. elseif( $_SESSION['search'] != '' )
  4394. {
  4395. $query = $_SESSION['search'];
  4396. $search_query = " WHERE $search_by LIKE '%$query%'";
  4397. }
  4398. else
  4399. {
  4400. $search_query = '';
  4401. }
  4402. $db_show = $_SESSION['show'];
  4403. $db_list = $_SESSION['list'];
  4404. $db_order = $_SESSION['order'];
  4405. $fullemail = $_SESSION['fullemail'];
  4406. $limit = $_SESSION['limit'];
  4407. $limit_num = $_SESSION['limit_num'];
  4408. $start = $_SESSION['start'];
  4409. if( $_SESSION['show'] == 'admin' )
  4410. {
  4411. $db_show = ' WHERE user_level=1';
  4412. }
  4413. elseif( $_SESSION['show'] == 'mod' )
  4414. {
  4415. $db_show = ' WHERE user_level=2';
  4416. }
  4417. elseif( $_SESSION['show'] == 'hidden' )
  4418. {
  4419. $db_show = ' WHERE user_allow_viewonline=0';
  4420. }
  4421. elseif( $_SESSION['show'] == 'inactive' )
  4422. {
  4423. $db_show = ' WHERE user_active=0';
  4424. }
  4425. elseif( $_SESSION['show_ban'] == true && $_SESSION['search'] != '' )
  4426. {
  4427. $_SESSION['errors']['index'][] = 'The search feature cannot be used while "Show" is set to "Banned".';
  4428. }
  4429. else
  4430. {
  4431. $db_show = '';
  4432. }
  4433. /****************************************************************************************
  4434. //
  4435. //
  4436. //
  4437. //
  4438. //
  4439. // This actually lists the users
  4440. //
  4441. //
  4442. //
  4443. //
  4444. //
  4445. ****************************************************************************************/
  4446. // $result = mysql_query("SELECT * FROM $phpbb_users$db_show$search_query ORDER BY $db_list $db_order LIMIT $start$limit");
  4447. $result = mysql_query("SELECT * FROM $phpbb_users$db_show$search_query ORDER BY $db_list $db_order LIMIT $start$limit");
  4448. $current_result = mysql_query("SELECT * FROM $phpbb_users$db_show$search_query ORDER BY $db_list $db_order");
  4449. $row_result = mysql_query("SELECT * FROM $phpbb_users");
  4450. $total_row_result = mysql_query("SELECT * FROM $phpbb_users");
  4451. $listed_row_count = mysql_num_rows($result);
  4452. $current_row_count = mysql_num_rows($total_row_result);
  4453. $total_row_count = mysql_num_rows($total_row_result);
  4454. // echo "$result = mysql_query(\"SELECT * FROM $phpbb_users$db_show$search_query ORDER BY $db_list $db_order LIMIT $start$limit\");";
  4455. if( $_SESSION['show'] == 'admin' || $_SESSION['show'] == 'hidden' || $_SESSION['show'] == 'inactive' || $_SESSION['show'] == 'mod' || $_SESSION['search'] != '' )
  4456. {
  4457. $row_count = mysql_num_rows($current_result);
  4458. }
  4459. else
  4460. {
  4461. $row_count = mysql_num_rows($row_result);
  4462. }
  4463. // echo "Start: $start<br />Limit Num: $limit_num";
  4464. if( ( $row_count - $start ) > $limit_num )
  4465. {
  4466. $limit_temp1 = $start + $limit_num;
  4467. $limit_next = '<a href="?start='.$limit_temp1.'">Next '.$limit_num.'</a>';
  4468. }
  4469. else
  4470. {
  4471. $limit_next = 'Next '.$limit_num.'';
  4472. }
  4473. if( $start > 0 )
  4474. {
  4475. $limit_first = '<a href="?start=0">First</a>';
  4476. }
  4477. else
  4478. {
  4479. $limit_first = 'First';
  4480. }
  4481. if( $_SESSION['show'] == 'admin' || $_SESSION['show'] == 'hidden' || $_SESSION['show'] == 'inactive' || $_SESSION['show'] == 'mod' || $_SESSION['search'] != '' )
  4482. {
  4483. $row_count = mysql_num_rows($current_result);
  4484. }
  4485. else
  4486. {
  4487. $row_count = mysql_num_rows($row_result);
  4488. }
  4489. $last_counter = 1;
  4490. // echo $last_counter * $limit_num;
  4491. // echo "<br /> Current Row Count: $current_row_count";
  4492. // echo "<br /> Current Row Count: $row_count";
  4493. // echo "<br />Session List: ".$_SESSION['list']."<br />";
  4494. while( ( $limit_num * $last_counter ) < $row_count )
  4495. {
  4496. if( $last_counter > 100000 )
  4497. {
  4498. echo '<br /><br /><br /><center><font size="5" color="#ff0000">$Last_Counter Exeeded 100,000, please contact <a href="mailto:starfoxtj@yahoo.com">starfoxtj@yahoo.com</a> with this error message, the number of users your board has, as well as which "view settings" you were using next to the sort button.</font></center><br /><br /><br /><br /><br /><br />';
  4499. exit();
  4500. break;
  4501. }
  4502. $last_counter++;
  4503. }
  4504. // echo "<br />Row count: $row_count";
  4505. // echo "<br />Last Counter: $last_counter<br />Total: ".$limit_num * $last_counter;
  4506. $last_page_counter = ( $last_counter * $limit_num ) - $limit_num;
  4507. // echo "<br />Last Page Counter: $last_page_counter";
  4508. if( $limit_num >= ( $row_count - $start ) )
  4509. {
  4510. $limit_last = 'Last';
  4511. }
  4512. else
  4513. {
  4514. $limit_last = '<a href="?start='.$last_page_counter.'">Last</a>';
  4515. }
  4516. // echo "<br />Start: $start<br />Rowcount: $row_count<br />Difference:";
  4517. // echo $row_count - $start;
  4518. if( $start >= $limit_num )
  4519. {
  4520. $limit_temp2 = $start - $limit_num;
  4521. $limit_previous = '<a href="?start='.$limit_temp2.'">Previous '.$limit_num.'</a>';
  4522. }
  4523. else
  4524. {
  4525. $limit_previous = 'Previous '.$limit_num.'';
  4526. }
  4527. /* if( $_SESSION['user_level'] == 'admin' || ( $_SESSION['user_level'] == 'mod' && $modrank == 'yes' ) )
  4528. {
  4529. echo 'Delete: yes';
  4530. }
  4531. else
  4532. {
  4533. echo 'Delete: no';
  4534. } */
  4535. ?>
  4536. <html>
  4537. <head>
  4538. <title>PHPBB Admin ToolKit v<?php echo $_SESSION['toolkitversion']; ?></title>
  4539. <SCRIPT LANGUAGE="JavaScript">
  4540. function placeFocus() {
  4541. if (document.forms.length > 0) {
  4542. var field = document.forms[0];
  4543. for (i = 0; i < field.length; i++) {
  4544. if ((field.elements[i].name == "password") || (field.elements[i].type == "textarea") || (field.elements[i].type.toString().charAt(0) == "s")) {
  4545. document.forms[2].elements[i].focus();
  4546. break;
  4547. }
  4548. }
  4549. }
  4550. }
  4551. </script>
  4552. <script type="text/javascript">
  4553. function boxOK(boxname) {
  4554. var not_these = ['confirm','confirm_date','extra','clear_posts','retain_pms','double_hash'];
  4555. var name, i = 0;
  4556. while (name = not_these[i++]) if (name == boxname) return false;
  4557. return true;
  4558. }
  4559. function checkUncheckAll(oCheckbox) {
  4560. var el, i = 0, bWhich = oCheckbox.checked, oForm = oCheckbox.form;
  4561. while (el = oForm[i++])
  4562. if (el.type == 'checkbox' && boxOK(el.name)) el.checked = bWhich;
  4563. }
  4564. </script>
  4565. </head>
  4566. <body link="#0000ff" vlink="#0000ff" alink="#0000ff" OnLoad="placeFocus()" onload="document.forms[0].reset()">
  4567. <?php
  4568. echo '<center>';
  4569. echo '<table border="0" bgcolor="#ffffff" cellspacing="1" cellpadding="3">';
  4570. echo '<tr><td><div align="center">'.$_SESSION['toolkit_title'].'</div></td></tr>';
  4571. echo '<tr><td><table border="0" width="100%" cellpadding="0" cellspacing="0"><tr><td align="left">Logged in as: <b>'.$_SESSION['user_level'].'</b></td><td align="right">PHPBB Version: <b>2'.$phpbb_version.'</b></td></tr></table></td></tr></table>';
  4572. // Begin error reporting section
  4573. if( isset( $_SESSION['errors']['index'] ) )
  4574. {
  4575. foreach( $_SESSION['errors']['index'] as $error )
  4576. {
  4577. echo "<br />\n";
  4578. echo $error;
  4579. echo "<br />\n";
  4580. }
  4581. unset( $_SESSION['errors']['index'] );
  4582. }
  4583. if( isset( $_SESSION['errors']['edituser'] ) )
  4584. {
  4585. foreach( $_SESSION['errors']['edituser'] as $error )
  4586. {
  4587. echo "<br />\n";
  4588. echo $error;
  4589. echo "<br />\n";
  4590. }
  4591. unset( $_SESSION['errors']['edituser'] );
  4592. }
  4593. // End error reporting section
  4594. echo '</center><br />';
  4595. ?>
  4596. <center>
  4597. <table>
  4598. <table width="95%" border="0" bgcolor="#ffffff" cellspacing="1" cellpadding="3">
  4599. <tr>
  4600. <td>
  4601. <center>
  4602. <table border="0" width="100%" bgcolor="#ffffff" cellspacing="1" cellpadding="3">
  4603. <tr>
  4604. <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="POST">
  4605. <td width="70" valign="top">
  4606. Show:
  4607. </td>
  4608. <td valign="top">
  4609. <select name="show">
  4610. <option value="admin"<?php if( $_SESSION['show'] == 'admin' ) { echo ' selected'; } ?>>Administrators</option>
  4611. <option value="mod"<?php if( $_SESSION['show'] == 'mod' ) { echo ' selected'; } ?>>Moderators</option>
  4612. <option value="hidden"<?php if( $_SESSION['show'] == 'hidden' ) { echo ' selected'; } ?>>Hidden Users</option>
  4613. <option value="inactive"<?php if( $_SESSION['show'] == 'inactive' ) { echo ' selected'; } ?>>Inactive Users</option>
  4614. <option value="banned"<?php if( $_SESSION['show_ban'] == true ) { echo ' selected'; } ?>>Banned Users</option>
  4615. <option value="all"<?php if( $_SESSION['show'] == 'all' ) { echo ' selected'; } ?>>All Users</option>
  4616. </select>
  4617. </td>
  4618. <td align="right" colspan="2">
  4619. <?php
  4620. if( $_SESSION['user_level'] == 'admin' )
  4621. {
  4622. echo '<a href="?mode=security_scan"><font color="#ff0000"><b>Run Security Scan</a></b></font>';
  4623. }
  4624. else
  4625. {
  4626. echo '&nbsp';
  4627. }
  4628. ?>
  4629. </td>
  4630. </tr>
  4631. <tr>
  4632. <td valign="top">
  4633. Order By:
  4634. </td>
  4635. <td valign="top" colspan="2">
  4636. <select name="list">
  4637. <option value="user_id"<?php if ( $db_list == 'user_id' ) { echo ' selected'; } ?>>User ID</option>
  4638. <option value="username"<?php if ( $db_list == 'username' ) { echo ' selected'; } ?>>Username</option>
  4639. <option value="user_email"<?php if ( $db_list == 'user_email' ) { echo ' selected'; } ?>>Email Address</option>
  4640. <option value="user_posts"<?php if ( $db_list == 'user_posts' ) { echo ' selected'; } ?>>Post Count</option>
  4641. <option value="user_level"<?php if ( $db_list == 'user_level' ) { echo ' selected'; } ?>>User Level</option>
  4642. <option value="user_active"<?php if ( $db_list == 'user_active' ) { echo ' selected'; } ?>>Active/Inactive</option>
  4643. <option value="user_regdate"<?php if ( $db_list == 'user_regdate' ) { echo ' selected'; } ?>>Date Joined</option>
  4644. <option value="user_lastvisit"<?php if ( $db_list == 'user_lastvisit' ) { echo ' selected'; } ?>>Last Visit</option>
  4645. </select>
  4646. <select name="order">
  4647. <option value="ASC"<?php if( $_SESSION['order'] == 'ASC' ) { echo ' selected'; } ?>>Ascending</option>
  4648. <option value="DESC"<?php if( $_SESSION['order'] == 'DESC' ) { echo ' selected'; } ?>>Decending</option>
  4649. </select>
  4650. </td>
  4651. <td align="right">
  4652. <?php
  4653. if( $_SESSION['user_level'] == 'admin' )
  4654. {
  4655. echo '<a href="?mode=phpinfo" target="_blank">Display PHPInfo</a>';
  4656. }
  4657. else
  4658. {
  4659. echo '&nbsp';
  4660. }
  4661. ?>
  4662. </td>
  4663. </tr>
  4664. <tr>
  4665. <td valign="top">
  4666. Emails:
  4667. </td>
  4668. <td valign="top" colspan="3">
  4669. <table border="0" cellpadding="0" cellspacing="0" width="100%">
  4670. <tr>
  4671. <td valign="top" align="left">
  4672. <select name="fullemail">
  4673. <option value="full"<?php if( $_SESSION['fullemail'] == 'full' ) { echo ' selected'; } ?>>Full</option>
  4674. <option value="short"<?php if( $_SESSION['fullemail'] == 'short' ) { echo ' selected'; } ?>>Short</option>
  4675. </select>
  4676. <td align="right" valign="top">
  4677. <input type="submit" name="search_by_submit" value="Search By:" />
  4678. <select name="search_by">
  4679. <option value="user_id"<?php if( $_SESSION['search_by'] == 'user_id' ) { echo ' selected'; } ?>>User ID</option>
  4680. <option value="username"<?php if( $_SESSION['search_by'] == 'username' ) { echo ' selected'; } ?>>Username</option>
  4681. <option value="user_email"<?php if( $_SESSION['search_by'] == 'user_email' ) { echo ' selected'; } ?>>Email</option>
  4682. <option value="user_website"<?php if( $_SESSION['search_by'] == 'user_website' ) { echo ' selected'; } ?>>Website</option>
  4683. <option value="user_occ"<?php if( $_SESSION['search_by'] == 'user_occ' ) { echo ' selected'; } ?>>Occupation</option>
  4684. <option value="user_interests"<?php if( $_SESSION['search_by'] == 'user_interests' ) { echo ' selected'; } ?>>Interests</option>
  4685. <option value="user_sig"<?php if( $_SESSION['search_by'] == 'user_sig' ) { echo ' selected'; } ?>>Signiture</option>
  4686. </select>
  4687. <?php
  4688. // if( $_SESSION['search_by'] == 'username' ) { echo '<a href="?search_by=user_email">Email Address</a>'; } else { echo '<a href="?search_by=username">Username</a>'; }
  4689. ?>
  4690. </td>
  4691. </tr>
  4692. </table>
  4693. </td>
  4694. </tr>
  4695. <tr>
  4696. <td valign="top">
  4697. Display:
  4698. </td>
  4699. <td colspan="3">
  4700. <table border="0" cellpadding="0" cellspacing="0" width="100%">
  4701. <tr>
  4702. <td valign="top">
  4703. <select name="limit_num">
  4704. <option value="25"<?php if( $_SESSION['limit_num'] == 25 ) { echo ' selected'; } ?>>25 Users</option>
  4705. <option value="50"<?php if( $_SESSION['limit_num'] == 50 ) { echo ' selected'; } ?>>50 Users</option>
  4706. <option value="75"<?php if( $_SESSION['limit_num'] == 75 ) { echo ' selected'; } ?>>75 Users</option>
  4707. <option value="100"<?php if( $_SESSION['limit_num'] == 100 ) { echo ' selected'; } ?>>100 Users</option>
  4708. <option value="150"<?php if( $_SESSION['limit_num'] == 150 ) { echo ' selected'; } ?>>150 Users</option>
  4709. <option value="200"<?php if( $_SESSION['limit_num'] == 200 ) { echo ' selected'; } ?>>200 Users</option>
  4710. <option value="all"<?php if( $_SESSION['limit_num'] == $row_count || $_SESSION['limit_num'] == $current_row_count ) { echo ' selected'; } ?>>All Users</option>
  4711. </select> <input type="submit" value="Sort"></form>
  4712. </td>
  4713. <td align="center">
  4714. <?php if( $_SESSION['search'] != '' ) { echo '<a href="'.$_SERVER['PHP_SELF'].'?search=">Clear Search</a>'; } ?>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  4715. </td>
  4716. <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="GET">
  4717. <td align="right" valign="top">
  4718. <input type="submit" value="Go">
  4719. <select name="mode">
  4720. <?php if( $_SESSION['user_level'] == 'mod' && $modban == 'no' ) { ?><option value="banlist" selected>----------</option><?php } else { ?><option value="banlist">Banlist</option><?php } ?>
  4721. <?php if( $_SESSION['user_level'] == 'admin' ) { ?><option value="config" selected>Board Config</option><?php } ?>
  4722. </select></form>
  4723. </td>
  4724. </tr>
  4725. </table>
  4726. </td>
  4727. </tr>
  4728. </table>
  4729. <table border="0" width="100%" bgcolor="#ffffff" cellspacing="1" cellpadding="3">
  4730. <tr>
  4731. <td valign="top">
  4732. <font size="2">Users: <?php echo $total_row_count.' - Listed: '.$listed_row_count; ?></font>
  4733. </td>
  4734. <td valign="top" colspan="3">
  4735. <table border="0" cellpadding="0" cellspacing="0" width="100%">
  4736. <tr>
  4737. <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="POST" />
  4738. <td align="center" valign="top">
  4739. <?php echo $limit_first; ?> - <?php echo $limit_previous; ?>&nbsp;&nbsp;&nbsp;
  4740. <input type="text" name="editspecificuser"<?php if( $_SESSION['search'] != '' ) { echo ' value="'.$_SESSION['search'].'"'; } ?>style="border-right: black 1px solid; border-top: black 1px solid; border-left: black 1px solid; border-bottom: black 1px solid" size="25" maxlength="255">&nbsp;&nbsp;<input type="submit" value=" Search User ">
  4741. &nbsp;&nbsp;&nbsp;<?php echo $limit_next; ?> - <?php echo $limit_last; ?></form>
  4742. </td>
  4743. <td align="right" valign="top">
  4744. <a href="?mode=logout">Logout</a>
  4745. </td>
  4746. </tr>
  4747. </table>
  4748. </td>
  4749. </tr>
  4750. </table>
  4751. <center><table width="100%" border="0" style="border:2px solid black;" bgcolor="#f5f5f5" cellspacing="1" cellpadding="3">
  4752. <tr>
  4753. <form action="<?php echo $index; ?>" method="POST" />
  4754. <td bgcolor="#d5d5d5" align="center" width="5%" cellpadding="5">
  4755. <input type="checkbox" name="checkall" onclick="checkUncheckAll(this)" />
  4756. </td>
  4757. <td bgcolor="#d5d5d5" width="10%" cellpadding="5">
  4758. <div align="center"><a href="?list=user_id&order=<?php if( $_SESSION['order'] == 'ASC' ) { echo 'DESC'; } else { echo 'ASC'; } ?>"><b>ID:</a></div>
  4759. </td>
  4760. <td bgcolor="#d5d5d5" width="20%" cellpadding="5">
  4761. <div align="center"><a href="?list=username&order=<?php if( $_SESSION['order'] == 'ASC' ) { echo 'DESC'; } else { echo 'ASC'; } ?>"><b>Username:</a></div>
  4762. </td>
  4763. <td bgcolor="#d5d5d5" width="20%" cellpadding="5">
  4764. <div align="center"><a href="?list=user_email&order=<?php if( $_SESSION['order'] == 'ASC' ) { echo 'DESC'; } else { echo 'ASC'; } ?>"><b>Email:</a></div>
  4765. </td>
  4766. <td bgcolor="#d5d5d5" width="8%" cellpadding="5">
  4767. <div align="center"><a href="?list=user_posts&order=<?php if( $_SESSION['order'] == 'ASC' ) { echo 'DESC'; } else { echo 'ASC'; } ?>"><b>Posts:</a></div>
  4768. </td>
  4769. <td bgcolor="#d5d5d5" width="8%" cellpadding="5">
  4770. <div align="center"><a href="?list=user_level&order=<?php if( $_SESSION['order'] == 'ASC' ) { echo 'DESC'; } else { echo 'ASC'; } ?>"><b>Level:</a></div>
  4771. </td>
  4772. <td bgcolor="#d5d5d5" width="7%" cellpadding="5">
  4773. <div align="center"><a href="?list=user_active&order=<?php if( $_SESSION['order'] == 'ASC' ) { echo 'DESC'; } else { echo 'ASC'; } ?>"><b>Active:</a></div>
  4774. </td>
  4775. <td bgcolor="#d5d5d5" width="7%" cellpadding="5">
  4776. <div align="center"><a href="?list=user_regdate&order=<?php if( $_SESSION['order'] == 'ASC' ) { echo 'DESC'; } else { echo 'ASC'; } ?>"><b>Joined</a></div>
  4777. </td>
  4778. <td bgcolor="#d5d5d5" width="7%" cellpadding="5">
  4779. <div align="center"><a href="?list=user_lastvisit&order=<?php if( $_SESSION['order'] == 'ASC' ) { echo 'DESC'; } else { echo 'ASC'; } ?>"><b>Visit:</a></div>
  4780. </td>
  4781. <td bgcolor="#d5d5d5" width="10%" cellpadding="5">
  4782. <div align="center">Ban:</div>
  4783. </td>
  4784. </tr>
  4785. <?php
  4786. if( 0 == 0 )
  4787. { //3.9-1
  4788. while( $myrow = mysql_fetch_array($result) )
  4789. { //3.10
  4790. if( $myrow['user_level'] == 0 )
  4791. { //3.10.1
  4792. $userlevel = "User";
  4793. } //3.10.1
  4794. elseif( $myrow['user_level'] == 1 )
  4795. { //3.10.2
  4796. $userlevel = "Admin";
  4797. } //3.10.2
  4798. elseif( $myrow['user_level'] == 2 )
  4799. { //3.10.3
  4800. $userlevel = "Mod";
  4801. } //3.10.3
  4802. if( $myrow['user_active'] == 1 )
  4803. { //3.10.3-1
  4804. $useractive = "Yes";
  4805. } //3.10.3-1
  4806. else
  4807. { //3.10.3-2
  4808. $useractive = "No";
  4809. } //3.10.3-2
  4810. $user_id = $myrow['user_id'];
  4811. $bantable = mysql_query("SELECT * FROM $phpbb_banlist WHERE ban_userid=$user_id");
  4812. $banstat = '-';
  4813. $banrow = mysql_fetch_array($bantable);
  4814. if( isset( $banrow['ban_userid'] ) )
  4815. { //3.10.4
  4816. $banstat = 'Banned';
  4817. if( $_SESSION['user_level'] == "admin" )
  4818. { //3.10.4.1
  4819. if( isset( $_GET['show'] ) )
  4820. { //3.10.4.1.1
  4821. $banstat = '<a href="'.$_SERVER['PHP_SELF'].'?show='.$_GET['show'].'&unban='.$myrow['user_id'].'">UnBan</a>';
  4822. } //3.10.4.1.1
  4823. else
  4824. { //3.10.4.1.2
  4825. $banstat = '<a href="'.$_SERVER['PHP_SELF'].'?unban='.$myrow['user_id'].'">UnBan</a>';
  4826. } //3.10.4.1.2
  4827. } //3.10.4.1
  4828. if( $_SESSION['user_level'] == "mod" && $modban == 'yes' )
  4829. { //3.10.4.2
  4830. $banstat = '<a href="'.$_SERVER['PHP_SELF'].'?unban='.$myrow['user_id'].'">UnBan</a>';
  4831. } //3.10.4.2
  4832. } //3.10.4
  4833. if( isset( $_GET['show'] ) && $_GET['show'] == "admin" )
  4834. { //3.10.5
  4835. if( $myrow['user_level'] != 1 )
  4836. { //3.10.5.1
  4837. continue;
  4838. } //3.10.5.1
  4839. } //3.10.5
  4840. if( $_SESSION['show_ban'] == true )
  4841. { //3.10.6
  4842. if( $banstat == "-" )
  4843. { //3.10.6.1
  4844. continue;
  4845. } //3.10.6.1
  4846. } //3.10.6
  4847. if( isset( $_GET['show'] ) && $_GET['show'] == "inactive" )
  4848. { //3.10.6-1
  4849. if( $myrow['user_active'] == 1 )
  4850. { //3.10.6-1.1
  4851. continue;
  4852. } //3.10.6-1.1
  4853. } //3.10.6-1
  4854. $useremail = $myrow['user_email'];
  4855. if( isset( $_SESSION['fullemail'] ) && $_SESSION['fullemail'] == "full" )
  4856. {
  4857. $useremailshort = $useremail;
  4858. $emaildots = "&nbsp;";
  4859. }
  4860. else
  4861. {
  4862. $useremailshort = substr( $useremail, 0, 10 );
  4863. if ( strlen( $useremail ) > 10 )
  4864. { //3.10.6.2
  4865. $emaildots = "...";
  4866. } //3.10.6.2
  4867. else
  4868. { //3.10.6.2
  4869. $emaildots = "";
  4870. } //3.10.6.2
  4871. }
  4872. ?>
  4873. <tr>
  4874. <td bgcolor="#e5e5e5"><div align="center"><input type="checkbox" name="user[]" value="<?php echo $myrow['user_id']; ?>" /></div></td>
  4875. <td bgcolor="#c5c5c5"><div align="left"><?php echo $myrow['user_id']; ?></div></td>
  4876. <td bgcolor="#e5e5e5"><div align="left"><a href="?user_id=<?php echo $myrow['user_id']; ?>"><?php echo $myrow['username']; ?></a><?php if( $myrow['user_allow_viewonline'] == 0 ) { echo ' (H)'; } ?></div></td>
  4877. <td bgcolor="#c5C5c5" nowrap><div align="left"><?php if( $myrow['user_id'] == -1 ) { echo '<center>-</center>'; } else { ?>&nbsp;<a href="mailto:<?php echo $useremail; ?>"><?php echo $useremailshort.'</a>'; echo $emaildots; } ?></div></td>
  4878. <td bgcolor="#e5e5e5"><div align="right"><?php echo $myrow['user_posts']; ?></div></td>
  4879. <td bgcolor="#c5C5c5"><div align="right"><?php if( $userlevel == 'Admin' ) { echo "<font color=\"#ff0000\"><b>$userlevel</b></font>"; } elseif( $userlevel == 'Mod' ) { echo "<b>$userlevel</b>"; } else { echo $userlevel; } ?></div></td>
  4880. <td bgcolor="#e5e5E5"><div align="center"><?php echo $useractive; ?></div></td>
  4881. <td bgcolor="#c5C5c5" align="center" nowrap><div style="font-family: Verdana; font-size: 9px;"><?php echo date( "m/d/Y", $myrow['user_regdate'] ); ?></div></td>
  4882. <td bgcolor="#e5e5E5" align="center" nowrap><?php if( $myrow['user_lastvisit'] == 0 ) { echo '-'; } else { echo '<div style="font-family: Verdana; font-size: 9px;">'.date( "m/d/Y", $myrow['user_lastvisit'] ).'</div>'; } ?></td>
  4883. <td bgcolor="#c5C5c5"><div align="center"><?php echo $banstat; ?></div></td>
  4884. </tr>
  4885. <?php
  4886. } //3.10
  4887. } //3.9-1
  4888. else
  4889. { //3.9-2
  4890. ?>
  4891. <tr>
  4892. <td colspan="7">
  4893. <br />
  4894. <center>
  4895. No usernames found matching your search query.
  4896. </center>
  4897. <br />
  4898. </td>
  4899. </tr>
  4900. <?php
  4901. } //3.9-2
  4902. ?>
  4903. </table><br />
  4904. <table width="100%" border="0" height="40" style="border:2px solid black;" bgcolor="#ffffff" cellspacing="1" cellpadding="3">
  4905. <tr>
  4906. <td width="5%" bgcolor="#d5d5d5" align="center">
  4907. <input type="checkbox" name="checkall" onclick="checkUncheckAll(this)" />
  4908. </td>
  4909. <td width="95%" align="left" bgcolor="#e5e5e5">
  4910. With selected:
  4911. <select name="massuseraction">
  4912. <option value="---" selected>----------------------------------</option>
  4913. <option value="activate">Activate</option>
  4914. <option value="deactivate">Deactivate</option>
  4915. <option value="deactivate_and_drop">Deactivate & Drop Key</option><?php
  4916. if( $_SESSION['user_level'] == 'admin' || ( $_SESSION['user_level'] == 'mod' && $modban == 'yes' ) )
  4917. {
  4918. ?>
  4919. <option value="ban">Ban</option>
  4920. <option value="unban">Unban</option>
  4921. <?php
  4922. }
  4923. if( $_SESSION['user_level'] == 'admin' || ( $_SESSION['user_level'] == 'mod' && $modpost == 'yes' ) )
  4924. {
  4925. ?>
  4926. <option value="resync">Resync Post Count</option>
  4927. <?php
  4928. }
  4929. if( $_SESSION['user_level'] == 'admin' )
  4930. {
  4931. ?>
  4932. <option value="admin">Promote to Admin</option>
  4933. <option value="user">Demote to User</option>
  4934. <?php
  4935. }
  4936. ?>
  4937. <option value="clear_sig">Clear Signiture</option>
  4938. <option value="clear_website">Clear Website</option>
  4939. </select>
  4940. <input type="submit" value=" Go " /><?php
  4941. if( $_SESSION['user_level'] == 'admin' )
  4942. {
  4943. ?>
  4944. &nbsp;&nbsp;&nbsp;&nbsp;If promoting to admin, click here to confirm: <input type="checkbox" name="confirm" value="yes" />
  4945. <?php
  4946. }
  4947. ?>
  4948. </td>
  4949. </tr>
  4950. <?php
  4951. if( $_SESSION['user_level'] == 'admin' || $moddelete == 'yes' )
  4952. {
  4953. ?>
  4954. <tr>
  4955. <td width="5%" bgcolor="#d5d5d5" align="center">
  4956. &nbsp;
  4957. </td>
  4958. <td bgcolor="#e5e5e5">
  4959. With selected:
  4960. <input type="submit" name="delete_users" value=" Delete " /> <input type="text" name="delete_confirm" style="border-right: black 1px solid; border-top: black 1px solid; border-left: black 1px solid; border-bottom: black 1px solid" size="7" length="6" maxlength="6" /> (Type delete to confirm)&nbsp;&nbsp;&nbsp;&nbsp;<input type="checkbox" name="clear_posts" value="yes" />Clear Posts&nbsp;&nbsp;&nbsp;&nbsp;<input type="checkbox" name="retain_pms" value="yes" />Retain PMs<br />
  4961. </td>
  4962. </tr>
  4963. <?php
  4964. }
  4965. ?>
  4966. <?php
  4967. if( $_SESSION['user_level'] == 'admin' )
  4968. {
  4969. ?>
  4970. <tr>
  4971. <td width="5%" bgcolor="#d5d5d5" align="center">
  4972. &nbsp;
  4973. </td>
  4974. <td bgcolor="#e5e5e5">
  4975. <?php
  4976. $date_joined = time();
  4977. $date_joined_ap = date( "a", $date_joined );
  4978. ?>
  4979. With Selected: <input type="text" name="join_mm" value="<?php echo date( "m", $date_joined ); ?>" style="border-right: black 1px solid; border-top: black 1px solid; border-left: black 1px solid; border-bottom: black 1px solid" size="1" maxlength="2" /> /
  4980. <input type="text" name="join_dd" value="<?php echo date( "d", $date_joined ); ?>" style="border-right: black 1px solid; border-top: black 1px solid; border-left: black 1px solid; border-bottom: black 1px solid" size="1" maxlength="2" /> /
  4981. <input type="text" name="join_yy" value="<?php echo date( "Y", $date_joined ); ?>" style="border-right: black 1px solid; border-top: black 1px solid; border-left: black 1px solid; border-bottom: black 1px solid" size="3" maxlength="4" />
  4982. (mm/dd/yyyy)
  4983. <input type="text" name="join_time_hh" value="<?php echo date( "h", $date_joined ); ?>" style="border-right: black 1px solid; border-top: black 1px solid; border-left: black 1px solid; border-bottom: black 1px solid" size="1" maxlength="2" />h :
  4984. <input type="text" name="join_time_mm" value="<?php echo date( "i", $date_joined ); ?>" style="border-right: black 1px solid; border-top: black 1px solid; border-left: black 1px solid; border-bottom: black 1px solid" size="1"maxlength="2" />m
  4985. <input type="text" name="join_time_ss" value="<?php echo date( "s", $date_joined ); ?>" style="border-right: black 1px solid; border-top: black 1px solid; border-left: black 1px solid; border-bottom: black 1px solid" size="1"maxlength="2" />s
  4986. <select name="join_time_ap">
  4987. <option value="am"<?php if( $date_joined_ap == 'am' ) { echo ' selected'; } ?>>AM</option>
  4988. <option value="pm"<?php if( $date_joined_ap == 'pm' ) { echo ' selected'; } ?>>PM</option>
  4989. </select>
  4990. <input type="submit" name="change_date" value="Set User Joined Date" />
  4991. &nbsp;Click here to confirm: <input type="checkbox" name="confirm_date" value="yes" />
  4992. </td>
  4993. </tr>
  4994. <?php
  4995. }
  4996. ?>
  4997. <?php if( $_SESSION['user_level'] == 'admin' )
  4998. {
  4999. ?>
  5000. <tr>
  5001. <td width="5%" bgcolor="#d5d5d5" align="center">
  5002. &nbsp;
  5003. </td>
  5004. <td bgcolor="#e5e5e5">
  5005. &nbsp;
  5006. </td>
  5007. </tr>
  5008. <tr>
  5009. <td width="5%" bgcolor="#d5d5d5" align="center">
  5010. &nbsp;
  5011. </td>
  5012. <td bgcolor="#e5e5e5">
  5013. Export Email list:
  5014. <select name="export_type">
  5015. <option value="email_only">Email Addresses Only</option>
  5016. <option value="gmail_csv">GMail CSV Format</option>
  5017. <option value="hotmail_csv">Hotmail CSV Format</option>
  5018. <option value="yahoo_csv">Yahoo CSV Format</option>
  5019. <option value="outlook_csv" selected>Outlook CSV Format</option>
  5020. <option value="1&1_newsletter_csv">1&1 Newsletter CSV Format</option>
  5021. </select>
  5022. &nbsp<input type="submit" name="export_selected" value="Export Selected Users" />&nbsp;<input type="submit" name="export_all" value="Export ALL Users" />
  5023. </td>
  5024. </tr>
  5025. <?php
  5026. }
  5027. ?>
  5028. <tr>
  5029. <td width="5%" bgcolor="#d5d5d5" align="center">
  5030. &nbsp;
  5031. </td>
  5032. <td bgcolor="#e5e5e5">
  5033. &nbsp;
  5034. </td>
  5035. </tr>
  5036. <tr>
  5037. </form>
  5038. <td width="5%" bgcolor="#d5d5d5" align="center">
  5039. &nbsp;
  5040. </td>
  5041. <form method="POST" action="<?php echo $index; ?>">
  5042. <td bgcolor="#e5e5e5">
  5043. <input type="text" name="genhash" style="border-right: black 1px solid; border-top: black 1px solid; border-left: black 1px solid; border-bottom: black 1px solid" size="25" maxlength="255">&nbsp;&nbsp;<input type="submit" value=" Generate MD5 ">&nbsp;&nbsp;Double Hash: <input type="checkbox" name="double_hash" /> <font face="arial" size="2">(Do not check this for phpbb password hashes)</font>
  5044. <?php
  5045. if( isset( $_POST['genhash'] ) && $_POST['genhash'] != '' && isset( $_POST['double_hash'] ) )
  5046. {
  5047. echo '<br /><br />Hash: <b>'; $hash = $_POST['genhash']; echo md5( md5( $hash ) ).'</b><br />&nbsp;';
  5048. }
  5049. elseif( isset( $_POST['genhash'] ) && $_POST['genhash'] != '' && !isset( $_POST['double_hash'] ) )
  5050. {
  5051. echo '<br /><br />Hash: <b>'; $hash = $_POST['genhash']; echo md5( $hash ).'</b><br />&nbsp;';
  5052. }
  5053. ?>
  5054. </td>
  5055. </form>
  5056. </tr>
  5057. <tr>
  5058. </form>
  5059. <td width="5%" bgcolor="#d5d5d5" align="center">
  5060. &nbsp;
  5061. </td>
  5062. <form method="POST" action="<?php echo $index; ?>">
  5063. <td bgcolor="#e5e5e5">
  5064. <?php
  5065. $date_joined = time();
  5066. $date_joined_ap = date( "a", $date_joined );
  5067. ?>
  5068. <input type="text" name="join_mm" value="<?php echo date( "m", $date_joined ); ?>" style="border-right: black 1px solid; border-top: black 1px solid; border-left: black 1px solid; border-bottom: black 1px solid" size="1" maxlength="2" /> /
  5069. <input type="text" name="join_dd" value="<?php echo date( "d", $date_joined ); ?>" style="border-right: black 1px solid; border-top: black 1px solid; border-left: black 1px solid; border-bottom: black 1px solid" size="1" maxlength="2" /> /
  5070. <input type="text" name="join_yy" value="<?php echo date( "Y", $date_joined ); ?>" style="border-right: black 1px solid; border-top: black 1px solid; border-left: black 1px solid; border-bottom: black 1px solid" size="3" maxlength="4" />
  5071. (mm/dd/yyyy)
  5072. <input type="text" name="join_time_hh" value="<?php echo date( "h", $date_joined ); ?>" style="border-right: black 1px solid; border-top: black 1px solid; border-left: black 1px solid; border-bottom: black 1px solid" size="1" maxlength="2" />h :
  5073. <input type="text" name="join_time_mm" value="<?php echo date( "i", $date_joined ); ?>" style="border-right: black 1px solid; border-top: black 1px solid; border-left: black 1px solid; border-bottom: black 1px solid" size="1"maxlength="2" />m
  5074. <input type="text" name="join_time_ss" value="<?php echo date( "s", $date_joined ); ?>" style="border-right: black 1px solid; border-top: black 1px solid; border-left: black 1px solid; border-bottom: black 1px solid" size="1"maxlength="2" />s
  5075. <select name="join_time_ap">
  5076. <option value="am"<?php if( $date_joined_ap == 'am' ) { echo ' selected'; } ?>>AM</option>
  5077. <option value="pm"<?php if( $date_joined_ap == 'pm' ) { echo ' selected'; } ?>>PM</option>
  5078. </select>
  5079. <input type="submit" name="gen_timestamp" value="Generate Timestamp" />
  5080. <?php
  5081. if( isset( $_POST['gen_timestamp'] ) )
  5082. {
  5083. $time['mm'] = $_POST['join_mm'];
  5084. $time['dd'] = $_POST['join_dd'];
  5085. $time['yy'] = $_POST['join_yy'];
  5086. $time['time_hh'] = $_POST['join_time_hh'];
  5087. $time['time_mm'] = $_POST['join_time_mm'];
  5088. $time['time_ss'] = $_POST['join_time_ss'];
  5089. $time['time_ap'] = $_POST['join_time_ap'];
  5090. if( !$time = make_time( $time ) )
  5091. {
  5092. foreach( $_SESSION['errors']['make_time'] as $error )
  5093. {
  5094. $time = $error;
  5095. }
  5096. unset( $_SESSION['errors']['make_time'] );
  5097. }
  5098. echo '<br /><br />Timestamp: <b>'.$time.'</b><br />&nbsp;';
  5099. }
  5100. ?>
  5101. </td>
  5102. </form>
  5103. </tr>
  5104. </table>
  5105. </center>
  5106. </table>
  5107. <?php echo $_SESSION['copyrightfooter']; ?>
  5108. </center>
  5109. </body>
  5110. </html>
  5111. <?php
  5112. } //3.7-1
  5113. /**************************************************
  5114. Begin Login
  5115. **************************************************/
  5116. } //3
  5117. else
  5118. { //4
  5119. // Let's see someone get past this!
  5120. session_destroy();
  5121. //setcookie( "upload_toolkit_enabled", 'yes', 0, '/', $domain, 0 );
  5122. ?>
  5123. <html>
  5124. <head>
  5125. <title>PHPBB Admin ToolKit</title>
  5126. <SCRIPT LANGUAGE="JavaScript">
  5127. function placeFocus() {
  5128. if (document.forms.length > 0) {
  5129. var field = document.forms[0];
  5130. for (i = 0; i < field.length; i++) {
  5131. if ((field.elements[i].name == "password") || (field.elements[i].type == "textarea") || (field.elements[i].type.toString().charAt(0) == "s")) {
  5132. document.forms[0].elements[i].focus();
  5133. break;
  5134. }
  5135. }
  5136. }
  5137. }
  5138. </script>
  5139. </head>
  5140. <body link="#0000ff" vlink="#0000ff" alink="#0000ff" OnLoad="placeFocus()">
  5141. <center>
  5142. <table border="0" bgcolor="#ffffff" cellspacing="1" cellpadding="3">
  5143. <tr><td><div align="center"><?php echo $_SESSION['toolkit_title_nversion']; ?></div></td></tr>
  5144. </table><br />
  5145. </center>
  5146. <center>
  5147. <table border="0" bgcolor="#ffffff" cellspacing="1" cellpadding="3">
  5148. <tr>
  5149. <td>
  5150. <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="POST">
  5151. Enter Password to Continue:<br />
  5152. <input type="password" name="password" lengh="20" size="20" maxlengh="20">
  5153. <br /><?php
  5154. if( $modpassword != '' && $modpassword != 'd41d8cd98f00b204e9800998ecf8427e' )
  5155. {
  5156. echo '<input type="radio" name="usertype" value="admin" checked="checked">Admin&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="radio" name="usertype" value="mod">Mod<br />';
  5157. }
  5158. else
  5159. {
  5160. echo '<input type="hidden" name="usertype" value="admin">';
  5161. }
  5162. ?>
  5163. <br /><input TYPE="submit" VALUE=" Enter ">
  5164. </form>
  5165. </td>
  5166. </tr>
  5167. </table>
  5168. </center>
  5169. <?php
  5170. if( isset( $_SESSION['loginerror'] ) )
  5171. { //4.2.1
  5172. ?>
  5173. <center>
  5174. <table border="0" bgcolor="#ffffff" cellspacing="1" cellpadding="3">
  5175. <tr>
  5176. <td>
  5177. <br /><br /><?php echo $_SESSION['loginerror']; ?>
  5178. </td>
  5179. </tr>
  5180. </table>
  5181. <?php
  5182. } //4.2.1
  5183. ?>
  5184. </body>
  5185. </html>
  5186. <?php
  5187. } //4
  5188. ?>