I have been messing around with phpbb3 and integrating it into zencart where as you would sign up in zencart the registration details would be sent over to the phpbb3 database and create the user on the forum at the same time.
I have managed to get it all working except for one thing:
user_email_hash
At the moment I have the following:
$user_email_hash = crc32(strtolower($email_address));
As this is close, it is not 100% correct as the value I should get for the e-mail address
[email protected] should be:
21079953813
However with the above sql I get a value of:
210799538
As you can see it is short the last 2 digits.
I would like to know what sql I should use to get the correct crc32 value to send across to the phpbb3 database.
Thank you for your time & help.
Here is the current code I am using:
// use separate db connection with details from phpBB config file
if ($sniffer->phpBB['installed'] == true) {
require($sniffer->phpBB['phpbb_path'] . 'config.php');
$user_email_hash = crc32(strtolower($email_address));
$db_phpbb = new queryFactory();
$db_phpbb->connect($dbhost, $dbuser, $dbpasswd, $dbname, USE_PCONNECT, false);
$sql = "select max(user_id) as total from " . $table_prefix . TABLE_PHPBB_USERS;
$phpbb_users = $db_phpbb->Execute($sql);
$user_id = ($phpbb_users->fields['total'] + 1);
$sql = "insert into " . $table_prefix . TABLE_PHPBB_USERS . "
(user_id, user_type, group_id, username, username_clean, user_password, user_email, user_email_hash, user_regdate, user_inactive_reason, user_passchg, user_lastmark, user_inactive_time, user_lang, user_timezone, user_dst, user_style, user_dateformat)
values
('" . (int)$user_id . "', 1, 2, '" . $nick . "', '" . $nick . "', '" . md5($_POST['password']) . "', '" . $email_address . "', '" . $user_email_hash . "', '" . time() ."', 1, '" . time() ."', '" . time() ."', '" . time() ."', '" . en ."', 2, 1, 4, 'D M d, Y g:i a')";
$db_phpbb->Execute($sql);
$group_id = $db_phpbb->Insert_ID();
$sql = "INSERT INTO " . $table_prefix . TABLE_PHPBB_USER_GROUPS . " (user_id, group_id, group_leader, user_pending)
VALUES ($user_id, 2, 0, 0)";
$db_phpbb->Execute($sql);
$db->connect(DB_SERVER, DB_SERVER_USERNAME, DB_SERVER_PASSWORD, DB_DATABASE, USE_PCONNECT, false);
}
// End phppBB stuff
Bookmarks