Merge revisions:
[phpbb.git] / phpBB / develop / calc_email_hash.php
blobcf2bb5c418b59dfcbe5c11f9818944053f0deb59
1 <?php
2 // -------------------------------------------------------------
3 //
4 // $Id$
5 //
6 // FILENAME : calc_email_hash.php
7 // STARTED : Tue Feb 03, 2004
8 // COPYRIGHT : © 2004 phpBB Group
9 // WWW : http://www.phpbb.com/
10 // LICENCE : GPL vs2.0 [ see /docs/COPYING ]
11 //
12 // -------------------------------------------------------------
15 // Security message:
17 // This script is potentially dangerous.
18 // Remove or comment the next line (die(".... ) to enable this script.
19 // Do NOT FORGET to either remove this script or disable it after you have used it.
21 die("Please read the first lines of this script for instructions on how to enable it");
22 @set_time_limit(300);
24 define('IN_PHPBB', 1);
25 define('PHPBB_ROOT_PATH', './../');
26 define('PHP_EXT', substr(strrchr(__FILE__, '.'), 1));
27 include(PHPBB_ROOT_PATH . 'common.' . PHP_EXT);
29 $start = 0;
32 // Batch query for group members, call group_user_del
33 $sql = "SELECT user_id, user_email
34 FROM {$table_prefix}users
35 LIMIT $start, 100";
36 $result = $db->sql_query($sql);
38 if ($row = $db->sql_fetchrow($result))
42 $sql = "UPDATE {$table_prefix}users
43 SET user_email_hash = " . (crc32(strtolower($row['user_email'])) . strlen($row['user_email'])) . '
44 WHERE user_id = ' . $row['user_id'];
45 $db->sql_query($sql);
47 $start++;
49 while ($row = $db->sql_fetchrow($result));
51 echo "<br />Batch -> $start\n";
52 flush();
54 else
56 $start = 0;
58 $db->sql_freeresult($result);
60 while ($start);
62 echo "<p><b>Done</b></p>\n";