phpBB
Statistics
| Revision:

root / branches / phpBB-3_0_0 / phpBB / develop / adjust_usernames.php

History | View | Annotate | Download (981 Bytes)

1
<?php
2
/**
3
* Adjust username_clean column.
4
*
5
* You should make a backup from your users table in case something goes wrong
6
*/
7
die("Please read the first lines of this script for instructions on how to enable it");
8
9
set_time_limit(0);
10
11
define('IN_PHPBB', true);
12
$phpbb_root_path = './../';
13
$phpEx = substr(strrchr(__FILE__, '.'), 1);
14
include($phpbb_root_path . 'common.'.$phpEx);
15
16
// Start session management
17
$user->session_begin();
18
$auth->acl($user->data);
19
$user->setup();
20
21
$echos = 0;
22
23
$sql = 'SELECT user_id, username
24
        FROM ' . USERS_TABLE;
25
$result = $db->sql_query($sql);
26
27
while ($row = $db->sql_fetchrow($result))
28
{
29
        $sql = 'UPDATE ' . USERS_TABLE . "
30
                SET username_clean = '" . $db->sql_escape(utf8_clean_string($row['username'])) . "'
31
                WHERE user_id = " . $row['user_id'];
32
        $db->sql_query($sql);
33
34
        if ($echos > 200)
35
        {
36
                echo '<br />' . "\n";
37
                $echos = 0;
38
        }
39
40
        echo '.';
41
        $echos++;
42
43
        flush();
44
}
45
$db->sql_freeresult($result);
46
47
echo 'FINISHED';
48
49
// Done
50
$db->sql_close();
51
52
?>