We have now adoped Selenium for automated web application testing. This increases the quality level of our software and generates better confidence for our clients.

We have now adoped Selenium for automated web application testing. This increases the quality level of our software and generates better confidence for our clients.

A lot of websites may require phpBB plugged-in as an add-on to the main site. In such a case if the main website already has a membership module in place, then it is desirable that when a member signups on the main website, he also becomes a member in phpBB.
There are 3 ways of doing this:
Method 1 is cumbersome and messy as the user is forced to enter his details twice- once for the main site and then for phpbb. This is not a very good option as you are making the user do all the dirty work for you.
Method 2 is not possible with the latest version of phpBB (3.0 Olympus) as it requires Captcha authentication, unless you have a way of hacking the captcha code
Method 3 is very undesirable as there are around 4 tables and 60 fields to update when a member signs up. Besides some of the fields like password etc are hashed using code internal to phpBb.
Method 4 is the most seamless and safe.
It just needs 3 fields to be prefilled: username, user_password and user_email . The rest of the fields are filled with default values by phpBB.
The code is given below:
<div style="font-family: courier; color:black; font-size: 10px; background-color: #ffffd5; overflow-x: scroll;">define('IN_PHPBB', true);
define('ROOT_PATH', "../pathtoforums");
if (!defined('IN_PHPBB') || !defined('ROOT_PATH')) {
//exit();
}
else {
$phpEx = "php";
$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : ROOT_PATH . '/';
include($phpbb_root_path . 'common.' . $phpEx);
include($phpbb_root_path . 'includes/functions_user.' . $phpEx);
$arrTime = getdate();
$unixTime = strtotime($arrTime['year'] . "-" . $arrTime['mon'] . '-' . $arrTime['mday'] . " " . $arrTime['hours'] . ":" . $arrTime['minutes'] . ":" . $arrTime['seconds']);
$user_row = array(
'username' => $_GET['username'],
'user_password' => phpbb_hash($_GET['pwd']),
'user_email' => $_GET['email'],
'group_id' => (int) 2,
'user_timezone' => (float) 0,
'user_dst' => "0",
'user_lang' => "en",
'user_type' => 0,
'user_actkey' => "",
'user_ip' => $_SERVER['REMOTE_HOST'],
'user_regdate' => $unixTime,
'user_inactive_reason' => 0,
'user_inactive_time' => 0
);
// all the information has been compiled, add the user
// tables affected: users table, profile_fields_data table, groups table, and config table.
$user_id = user_add($user_row); }</div>
It is assumed that the user data is being passed to this page via a GET. The most important thing is the define(ROOT_PATH) directive-it should point to the base directory of phpbb. Eg.if it is installed in /phpbb then ROOT_PATH becomes /phpbb.One thing to remember is that if the username is a duplicate one, then phpbb stops execution and shows the error page. Of course, the easiest way around this is the main site’s membership module which is taking care of userid validation, only then would the phpbb code called so its unlikely you will get a duplicate member error.
Some pitfalls to avoid :