RkBlog

Hardware, programming and astronomy tutorials and reviews.

PHP-Fusion and IPB integration

How to integrate IPB login/register into PHP-Fusion

This tutorial shows how to integrate register, login and logout IPB operations in PHP-Fusion. The integration will work in PHP-Fusion (register a user in PHP-Fusion will register one in IPB).

- Install IPB forum in ipb folder in the main PHP-Fusion folder.
- Extract IBP SDK and copy: lib, ipbsdk_class.inc.php and ipbsdk_conf.inc.php to PHP-Fusion main folder. - Edit ipbsdk_conf.inc.php and replace with:
<?php
$root_path = 'ipb/';
$board_url = 'ipb';
$sdklang = "en";
$allow_caching = '1';

Open maincore.php and find:
<?php
$cookie_exp = isset($_POST['remember_me']) ? time() + 3600*24*30 : time() + 3600*3;
header("P3P: CP='NOI ADM DEV PSAi COM NAV OUR OTRo STP IND DEM'");
setcookie("fusion_user", $cookie_value, $cookie_exp, "/", "", "0");
redirect(BASEDIR."setuser.php?user=".$data['user_name'], "script");
Before add:
<?php
require_once 'ipbsdk_class.inc.php';
$sdk =& new IPBSDK();
$sdk->login($user_name, $_POST['user_pass']);

Open setuser.php and find:
<?php
if (isset($_REQUEST['logout']) && $_REQUEST['logout'] == "yes") {
After add:
<?php
require_once 'ipbsdk_class.inc.php';
$sdk =& new IPBSDK();
$sdk->logout();

Open register.php and find:
<?php
$result = dbquery("DELETE FROM ".$db_prefix."new_users WHERE user_code='$activate'");
After add:
<?php
require_once 'ipbsdk_class.inc.php';
$sdk =& new IPBSDK();
$sdk->create_account($user_info['user_name'], $user_info['user_password'], $user_info['user_email']);
Find:
<?php
$activation = $settings['admin_activation'] == "1" ? "2" : "0";
$result = dbquery("INSERT INTO ".$db_prefix."users (user_name, user_password, user_email, user_hide_email, user_location, user_birthdate, user_aim, user_icq, user_msn, user_yahoo, user_web, user_theme, user_offset, user_avatar, user_sig, user_posts, user_joined, user_lastvisit, user_ip, user_rights, user_groups, user_level, user_status) VALUES('$username', md5('".$password1."'), '".$email."', '$user_hide_email', '$user_location', '$user_birthdate', '$user_aim', '$user_icq', '$user_msn', '$user_yahoo', '$user_web', '$user_theme', '$user_offset', '', '$user_sig', '0', '".time()."', '0', '".USER_IP."', '', '', '101', '$activation')");
After add:
<?php
require_once 'ipbsdk_class.inc.php';
$sdk =& new IPBSDK();
$sdk->create_account($username, $password1, $email);
RkBlog

PHP Tutorials and Scripts, 14 July 2008,

Comment article