diff --git a/phpBB/develop/convert_usernames.php b/phpBB/develop/convert_usernames.php new file mode 100644 index 0000000000..ba5935eaa3 --- /dev/null +++ b/phpBB/develop/convert_usernames.php @@ -0,0 +1,67 @@ + +
+sql_query($sql); + +if(!$result) +{ + die("Unable to get users"); +} + +while ($row = $db->sql_fetchrow($result)) +{ + if (!preg_match('#(>)|(<)|(")|(&)#', $row['username'])) + { + if ($row['username'] != htmlspecialchars($row['username'])) + { + flush(); + $sql = "UPDATE " . USERS_TABLE . " + SET username = '" . str_replace("'", "''", htmlspecialchars($row['username'])) . "' + WHERE user_id = " . $row['user_id']; + if (!$db->sql_query($sql)) + { + echo "ERROR: Unable to rename user " . htmlspecialchars($row['username']) . " with ID " . $row['user_id'] . "" . print_r($db->sql_error()) . "