Permalink
Browse files

Added the tool to reset all users passwords

Signed-off-by: emanuele <emanuele45@gmail.com>
1 parent 74c8b5b commit 9ec97d14039168f11988ea65d7bade6429ff670d @emanuele45 emanuele45 committed Jul 27, 2013
Showing with 48 additions and 0 deletions.
  1. +48 −0 resetpwds.php
View
@@ -0,0 +1,48 @@
+<?php
+require_once('SSI.php');
+
+error_reporting(0);
+global $sourcedir, $smcFunc, $boardurl;
+require_once($sourcedir . '/Subs-Auth.php');
+
+$start = isset($_GET['start']) ? (int) $_GET['start'] : 0;
+$request = $smcFunc['db_query']('', '
+ SELECT COUNT(*)
+ FROM {db_prefix}members',
+ array()
+);
+list($usercount) = $smcFunc['db_fetch_row']($request);
+$smcFunc['db_free_result']($request);
+
+echo 'Users to process: ', $usercount - $start . '<br />';
+
+$time = time();
+// Let's do 5 seconds
+while (time() < ($time + 5))
+{
+ $request = $smcFunc['db_query']('', '
+ SELECT id_member
+ FROM {db_prefix}members
+ LIMIT {int:start}, 10',
+ array(
+ 'start' => $start,
+ )
+ );
+
+ while ($row = $smcFunc['db_fetch_assoc']($request))
+ resetPassword($row['id_member']);
+ $smcFunc['db_free_result']($request);
+ $start += 10;
+}
+
+if ($usercount >= $start)
+{
+ echo '<a id="cont" href="', $boardurl, '/resetpwds.php?start=', $start, '">click here to continue</a><script>
+ var href = document.getElementById("cont").href;
+ document.getElementById("cont").innerHTML="wait...";
+ setTimeout(function(){window.location = href;},3000);
+ </script>';
+ die();
+}
+
+echo 'nothing left!';

0 comments on commit 9ec97d1

Please sign in to comment.