https://www.icyphoenix.com/viewtopic.php?f=35&t=7004&p=48410#p48410 ----------------------------------- Mighty Gorgon Thu 25 Mar, 2010 11:09 Re: Function To Mass-register User Accounts? ----------------------------------- I have created a file for doing that a while ago... but never tested it on live websites and IP 1.3. You can have a try and let us know. [codeblock] 'username', 'user_password' => 'password', 'user_email' => 'email', 'user_style' => 1; 'user_lang' => 'english', 'user_timezone' => '0.00', 'user_dateformat' => 'Y/m/d - H:i', ); $users_data[] = array( 0 => 'username', 1 => 'password', 2 => 'email', 3 => 'user_style', 4 => 'lang', 5 => 'user_timezone', 6 => 'user_dateformat', ); CSV Example: "User 01","pwd01","user01@user01.com",1,"english","0.00","Y/m/d - H:i" "User 02","pwd02","user02@user01.com",1,"english","0.00","Y/m/d - H:i" "User 03","pwd03","user03@user01.com",1,"english","0.00","Y/m/d - H:i" */ $users_counter = 0; $handle = fopen('users_to_add.csv', 'r'); while (($data = fgetcsv($handle, 0, ',')) !== false) { $num = sizeof($data); for ($c = 0; $c < $num; $c++) { $users_data[$users_counter][$c] = $data[$c]; } $users_counter++; } fclose($handle); //include($phpbb_root_path . 'users_to_add.' . $phpEx); $users_list = ''; $total_users = sizeof($users_data); $users_this_step = min($users_start + $users_step, $total_users); $users_this_step = ($users_this_step == 0) ? $total_users : $users_this_step; $new_start = $users_start; include(IP_ROOT_PATH . 'includes/class_users.' . PHP_EXT); $users_class = new class_users(); $users_fields_name = array('username', 'user_password', 'user_email', 'user_style', 'user_lang', 'user_timezone', 'user_dateformat'); for ($i = $users_start; $i < $users_this_step; $i++) { $users_fields_values = array($users_data[$i][0], $users_data[$i][1], $users_data[$i][2], $config['default_style'], $config['default_lang'], $config['board_timezone'], $config['default_dateformat']); for ($j = 0; $j < sizeof($users_fields_name); $j++) { $users_data[$i][$j] = (empty($users_data[$i][$j])) ? $users_fields_values[$j] : $users_data[$i][$j]; $users_data[$i][$users_fields_name[$j]] = $users_fields_values[$j]; unset($users_data[$i][$j]); } $action_result = $users_class->create_user($users_data[$i]['username'], $users_data[$i]['user_password'], $users_data[$i]['user_email'], $users_data[$i]['user_style'], $users_data[$i]['user_lang'], $users_data[$i]['user_dateformat'], $users_data[$i]['user_timezone'], true, true); if ($action_result) { $users_list .= (($users_list == '') ? '' : ', ') . $users_data[$i]['username']; } $new_start++; } $message_text = 'The following users have been added to the DB:

' . $users_list; if ($new_start >= $total_users) { $message = 'All users have been imported correctly!

' . $message_text; $template->assign_vars(array( 'MESSAGE_TITLE' => $meta_content['page_title'], 'MESSAGE_TEXT' => $message, ) ); full_page_generation('message_body.tpl', 'Users Import', '', ''); } else { $redirect_url = append_sid('users_add.' . PHP_EXT . '?us=' . $new_start . '&up=' . $users_step); meta_refresh(3, $redirect_url); $message = 'The process is not finished yet, this page will redirect automatically in few seconds, please wait...

' . $message_text; message_die(GENERAL_MESSAGE, $message); } exit; ?>[/codeblock]