RkBlog

Hardware, programming and astronomy tutorials and reviews.

Integracja PHP-Fusion z IPB

Niniejszy przepis opisuje integrację rejestracji, logowania i wylogowania w PHP-Fusion z odpowiednimi czynnościami na forum IPB. Integracja działa tylko w PHP-Fusion -> IPB, nie działa od strony IPB.

<?php
$root_path = 'ipb/';
$board_url = 'ipb';
$sdklang = "en";
$allow_caching = '1';

Otwórz maincore.php i znajdź:
<?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");
Przed kodem, dodaj:
<?php
require_once 'ipbsdk_class.inc.php';
$sdk =& new IPBSDK();
$sdk->login($user_name, $_POST['user_pass']);

Otwórz setuser.php i znajdź:
<?php
if (isset($_REQUEST['logout']) && $_REQUEST['logout'] == "yes") {
Po kodzie, dodaj:
<?php
require_once 'ipbsdk_class.inc.php';
$sdk =& new IPBSDK();
$sdk->logout();

Otwórz register.php i znajdź:
<?php
$result = dbquery("DELETE FROM ".$db_prefix."new_users WHERE user_code='$activate'");
Po kodzie dodaj:
<?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']);
Znajdź:
<?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')");
Po kodzie, dodaj:
<?php
require_once 'ipbsdk_class.inc.php';
$sdk =& new IPBSDK();
$sdk->create_account($username, $password1, $email);
RkBlog

PHP-Fusion, 11 July 2008, Piotr Maliński

Comment article