Hi
Ive been trying to make a single login for zencart and phpbb2. I have successfully done it. code is pasted below.
This actually works. If you know a better way please tell me. :)
First i edited:
/includes/templates/yourtemplate/common/tpl_header.php
Code:
<img src="bridge.php" />
In the root of my shop, bridge.php contents
Code:
<?php // bridge.php
include_once ( "includes/application_top.php" );
define("IN_LOGIN", true);
define('IN_PHPBB', true);
$phpbb_root_path = './forum/';
include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'common.'.$phpEx);
if (!empty($_SESSION['customer_id'])) {
$query= "SELECT customers_nick,customers_password FROM customers WHERE customers_id ='".$_SESSION['customer_id']."'";
if (!($res=mysql_query($query))) {
$username='';
$password='';
}
if (mysql_num_rows($res)) {
list($username,$password)=mysql_fetch_row($res);
} else {
$username='';
$password='';
}
$query2= "SELECT user_id FROM phpbb_users WHERE username ='".$username."'";
if (!($res2=mysql_query($query2))) {
$fid = '';
}
if (mysql_num_rows($res2)) {
list($fid)=mysql_fetch_row($res2);
} else {
$fid = '';
}
$last_visit = 0;
$current_time = time();
session_begin($fid, encode_ip(zen_get_ip_address()), PAGE_INDEX, FALSE, $autologin, 0);
}
?>
Now when a member logins in the shop they are logged into the forum automatic. Theres gotta be a better way????:)
Im trying to figure out how to destroy the phpbb2 session.. will update soon...
Bookmarks