diff options
author | Paul S. Owen <psotfx@users.sourceforge.net> | 2004-02-03 17:22:29 +0000 |
---|---|---|
committer | Paul S. Owen <psotfx@users.sourceforge.net> | 2004-02-03 17:22:29 +0000 |
commit | 13f80fe2ef7a84923b3c3bd7741e65dcf799db93 (patch) | |
tree | d74015918729214760c4f562c12f5b45dbed0f14 /phpBB/develop/calc_email_hash.php | |
parent | 895059928ca60147646d609f0d6e5ca8662e7377 (diff) | |
download | forums-13f80fe2ef7a84923b3c3bd7741e65dcf799db93.tar forums-13f80fe2ef7a84923b3c3bd7741e65dcf799db93.tar.gz forums-13f80fe2ef7a84923b3c3bd7741e65dcf799db93.tar.bz2 forums-13f80fe2ef7a84923b3c3bd7741e65dcf799db93.tar.xz forums-13f80fe2ef7a84923b3c3bd7741e65dcf799db93.zip |
Update user table for email hashing? Suggested and implemented by lanzer ... we may as well give it a go too
git-svn-id: file:///svn/phpbb/trunk@4791 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB/develop/calc_email_hash.php')
-rw-r--r-- | phpBB/develop/calc_email_hash.php | 76 |
1 files changed, 76 insertions, 0 deletions
diff --git a/phpBB/develop/calc_email_hash.php b/phpBB/develop/calc_email_hash.php new file mode 100644 index 0000000000..a67b0f52a3 --- /dev/null +++ b/phpBB/develop/calc_email_hash.php @@ -0,0 +1,76 @@ +<?php +// ------------------------------------------------------------- +// +// $Id$ +// +// FILENAME : calc_email_hash.php +// STARTED : Tue Feb 03, 2004 +// COPYRIGHT : © 2004 phpBB Group +// WWW : http://www.phpbb.com/ +// LICENCE : GPL vs2.0 [ see /docs/COPYING ] +// +// ------------------------------------------------------------- + +// +// Security message: +// +// This script is potentially dangerous. +// Remove or comment the next line (die(".... ) to enable this script. +// Do NOT FORGET to either remove this script or disable it after you have used it. +// +die("Please read the first lines of this script for instructions on how to enable it"); +@set_time_limit(300); + +$db = $dbhost = $dbuser = $dbpasswd = $dbport = $dbname = ''; + +define('IN_PHPBB', 1); +define('ANONYMOUS', 1); +$phpEx = substr(strrchr(__FILE__, '.'), 1); +$phpbb_root_path='./../'; +include($phpbb_root_path . 'config.'.$phpEx); +require($phpbb_root_path . 'includes/acm/acm_' . $acm_type . '.'.$phpEx); +require($phpbb_root_path . 'includes/db/' . $dbms . '.'.$phpEx); +include($phpbb_root_path . 'includes/functions.'.$phpEx); + +$cache = new acm(); +$db = new sql_db(); + +// Connect to DB +$db->sql_connect($dbhost, $dbuser, $dbpasswd, $dbname, $dbport, false); + +$start = 0; +do +{ + // Batch query for group members, call group_user_del + $sql = "SELECT user_id, user_email + FROM {$table_prefix}users + LIMIT $start, 100"; + $result = $db->sql_query($sql); + + if ($row = $db->sql_fetchrow($result)) + { + do + { + $sql = "UPDATE {$table_prefix}users + SET user_email_hash = " . (crc32(strtolower($row['user_email'])) . strlen($row['user_email'])) . ' + WHERE user_id = ' . $row['user_id']; + $db->sql_query($sql); + + $start++; + } + while ($row = $db->sql_fetchrow($result)); + + echo "<br />Batch -> $start\n"; + flush(); + } + else + { + $start = 0; + } + $db->sql_freeresult($result); +} +while ($start); + +echo "<p><b>Done</b></p>\n"; + +?>
\ No newline at end of file |