Sunday, May 6, 2012

How to Add Users Remotely to a phpBB 3 forum with PHP

<?php
 

define('IN_PHPBB', true);

$phpEx = substr(strrchr(__FILE__, '.'), 1);


require($phpbb_root_path ."common.". $phpEx);
$user->session_begin();
$auth->acl($user->data);
$user->setup();

// Contains the user_add function
require("myForum/includes/functions_user.php");



//still nedd to validate user name and strip non chars.

$username = "IamTesting";
$email_address = "iam@testing.com";
$password = "sUperSeCURE92E#$";
$registration_time = time();
$group_id = 2;


$user_row = array(
    'username'              => $username,
    'user_password'         => phpbb_hash($password),
    'user_email'            => $email_address,
    'group_id'              => (int) $group_id,
    'user_regdate'          => $registration_time,
    'user_type'             => '0',
);



//uncomment the following line to display the array
//print_r($user_row);

// all the information has been compiled, add the user
// tables affected include: users table, 

// profile_fields_data table, groups table, and config table.
 

$user_id = user_add($user_row);

?>

Website Reboot 2012

Making plans to add some new projects this year.  And here's a preview of the new look. giwiganz.com