Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

[Contribution] phpBB-osCommerce Bridge


gabrielk

Recommended Posts

This mod acts as a bridge between phpBB and osCommerce. It includes the following features:

 

- Shared account creation. Accounts created in osCommerce are mirrored in phpBB.

 

- Shared login/logoff. Users who log into the shopping cart are also logged into phpBB. Logging off from phpBB or osCommerce logs you out of both systems. phpBB login is standardized to e-mail address + password combination like osCommerce. Logging into phpBB does NOT log you into osCommerce: this keeps users who are only signing in to post from signing into the shopping cart unaware, putting their personal information at risk should they forget to log off. Shopping carts should always require people to re-enter their password before signing into the cart area, and this emulates that behaviour.

 

- Usernames are created using first name + last initial. Most people don't want their last names publicized without their explicit authorization, for privacy and security reasons. Instead, this mod creates the usernames only using the last initial.

 

- Prevention of username collision with first name + last initial + sequential number. This mod counts how many usernames already exist similar to the first name + last initial combination (gabrielk) and automatically appends the next number to the username (gabrielk2, gabrielk3, etc) to ensure 2 users don't end up with the same auto-generated username.

 

- Site Name is keyed to Store Name. Editing the Store Name from the osCommerce administration panel updates your phpBB Site Name as well.

 

- Board Description is keyed to a new Store Slogan field. Editing the Store Slogan from the osCommerce administration panel updates your phpBB Board Description as well.

 

- Board E-mail is keyed to Store E-mail. Editing the Store E-Mail from the osCommerce administration panel updates your phpBB Board E-mail as well.

 

This mod has been tested with a clean insteall of phpBB 2.0.21 and a heavily modded install of osCommerce MS2. It is recommended to install phpBB into a subdirectory of /catalog/ and to use the same database as osCommerce for your tables. The goal of this mod is to incorporate the majority of the "bridge" functions into osCommerce, allowing simpler phpBB updates, greater security, and better reliability.

 

Based on:

phpBB mods:

- Username Or Email Login Mod v.1.0.4

by Johnpg82

osCommerce mods:

- pbpBB2 and osC shared account creation v.0.2

by anderskiel

- PHPBB 2.0.8a implementation

by chaveiro

 

Contribution: http://www.oscommerce.com/community/contributions,4710

Link to comment
Share on other sites

  • Replies 149
  • Created
  • Last Reply

Top Posters In This Topic

So I caught some bugs in the admin login of this contrib. Now it handles one-click login from the osC panel seamlessly, and you can control basic elements of the phpBB administrator account (username, password, e-mail address) from within osC.

 

Working on adding a package update on Monday. :)

Link to comment
Share on other sites

The login.php page is not working for me.

 

I'm getting this error on that page:

 

Warning: main(./DIR_WS_FORUMSextension.inc) [function.main]: failed to open stream: No such file or directory in /home/public_html/login.php on line 16

 

Warning: main(./DIR_WS_FORUMSextension.inc) [function.main]: failed to open stream: No such file or directory in /home/public_html/login.php on line 16

 

Warning: main() [function.include]: Failed opening './DIR_WS_FORUMSextension.inc' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/public_html/login.php on line 16

 

Warning: main(./DIR_WS_FORUMScommon.) [function.main]: failed to open stream: No such file or directory in /home/public_html/login.php on line 17

 

Warning: main(./DIR_WS_FORUMScommon.) [function.main]: failed to open stream: No such file or directory in /home/public_html/login.php on line 17

 

Warning: main() [function.include]: Failed opening './DIR_WS_FORUMScommon.' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/public_html/login.php on line 17

 

Warning: Cannot modify header information - headers already sent by (output started at /home/xleris/public_html/login.php:16) in /home/public_html/includes/functions/general.php on line 1196

 

Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/public_html/login.php:16) in /home/public_html/includes/functions/sessions.php on line 97

 

I've tried pasting the new code after:

 

require('includes/application_top.php');

 

instead of before as the instructions say. I got fewer errors, but still have errors.

 

In fact, quite a bit isn't working for me, but I've been slowing going through and correcting errors from the first contribution.

Has this happened to anyone else?

 

By the way, I was able to make a quick fix for the admin bug by removing tep_href_link and its associated braces from phpbb_admin.php.

 

This is a great mod and contribution! :thumbsup:

Link to comment
Share on other sites

The login.php page is not working for me.

 

I'm getting this error on that page:

 

Warning: main(./DIR_WS_FORUMSextension.inc) [function.main]: failed to open stream: No such file or directory in /home/public_html/login.php on line 16

 

That's what I get for trying to polish code at 6am. The instructions say:

$phpbb_root_path = './'.DIR_WS_FORUMS;

But the problem is, DIR_WS_FORUMS hasn't been defined yet. That chunk of code does need to be above application_top.php, so I recommend doing what I did:

$phpbb_root_path = './forums/';

...where "forums" is the RELATIVE path to your phpbb installation. In other words, /catalog/forums/ would be $phpbb_root_path='./forums/'; ...I'm not sure if the absolute path would work ($phpbb_root_path='/catalog/forums/';), but using a relative path works for me. :)

 

In fact, quite a bit isn't working for me, but I've been slowing going through and correcting errors from the first contribution.

Has this happened to anyone else?

I'd be interested to hear what errors you've been correcting. Since I've really only had time to test it on my own development site, it's quite possible I screwed up with some of the variable names (like above).

 

Some of it may also be related to mods that I have installed, where the code I included also includes those mod changes and I didn't manage to strip out the irrelevent bits.

 

By the way, I was able to make a quick fix for the admin bug by removing tep_href_link and its associated braces from phpbb_admin.php.

Glad that works for you. In the update that I'm hoping to post this weekend, I've re-worked the way the admin login works altogether. The incarnation that's up right now is quite bugged in that regard, I found out. You can still log in with the store owner's e-mail address & the administrator's password through the phpBB login page, but the new version just flat out logs you in and opens up the phpBB admin, like it should.

This is a great mod and contribution! :thumbsup:

Hey, thanks a lot. :) I tried to submit it bug-free, but alas, the best laid plans...

Link to comment
Share on other sites

Have you managed to work an update for this package yet?

 

BTW, great mod, been waiting for something like this for ages :D

Thanks! Hope it works for you.

Update is still on its way. :) One thing led to another and I ended up setting up a development server on my laptop with the updates still half-finished. Looks like there's a few more bugs in this initial release than I expected...I'd like to get those taken care of before I post the next version.

Link to comment
Share on other sites

Hi,

 

I was using SMF as a message board system and just deleted it today because this contribution came out. I'm currently installing phpBB.

 

One quick question would be.. can users create their own name to be used on the forum?

 

And also do you think there will be an update today? Haven't installed the contrib yet and to avoid any problems think I will hold off untill you have released it.

 

BTW, thank you so much for a bridge... I have been searching for months now.

 

-Dave

Link to comment
Share on other sites

I'd be interested to hear what errors you've been correcting. Since I've really only had time to test it on my own development site, it's quite possible I screwed up with some of the variable names (like above).

 

I had to change any reference to HTTPS_CATALOG_SERVER to HTTPS_SERVER since that was how my default config.php file was set up.

 

My /phpbb2/config.php file looked nothing like what the instructions showed, but that may be because the instructions do not show the actual db name, password, server, etc. I just copied the top section from the replacement (from the if statement to the last require statement) in the instructions and pasted it in the top of my phpbb config file, and it worked for me.

 

My SQL statement in /phpbb2/login.php was longer than the one that the instructions showed, so I only replaced part of it.

 

The instructions use .php as the extension for some of the tpl files, but I figured that out.

 

The instructions for /phpbb2/profile.php assume that the server is HTTPS, but mine isn't so I had to change from HTTPS to HTTP in some of the new code.

 

That's about it.

 

I did a temp fix to get around the errors on login.php - I didn't paste in the new code, just left catalog/login.php as was. :-"

I did some testing after I installed, and when I logged in as myself in the catalog, a new user in phpbb was created. :thumbsup:

 

But I was not able to log in to phpbb after that, even as the admin. :blink:

It kept giving me an error - I forget what it was. This may be due to me not putting the code into catalog/login.php, or some other bug I introduced by making changes to your code.

 

HTH

Link to comment
Share on other sites

osc is working, forums arent

 

 

Warning: main(../includes/configure.php) [function.main]: failed to open stream: No such file or directory in /homepages/14/d187646903/htdocs/silicongrove/shop/phpbb2/config.php on line 15

 

i have already looked into the code and replaced the parts that said forms/ with phpbb2 as i can see the directions seem to bounce back and forth

Link to comment
Share on other sites

  • 2 weeks later...
Hi,

 

I was using SMF as a message board system and just deleted it today because this contribution came out. I'm currently installing phpBB.

 

One quick question would be.. can users create their own name to be used on the forum?

 

And also do you think there will be an update today? Haven't installed the contrib yet and to avoid any problems think I will hold off untill you have released it.

 

BTW, thank you so much for a bridge... I have been searching for months now.

 

-Dave

 

Users are unable to set their own usernames. Currently my script is set to update their name again automatically if they change their name in osC so it will overwrite this. If you allow it via phpBB, just be sure to take out the code in the osC account edit area that updates the phpBB username.

Link to comment
Share on other sites

I had to change any reference to HTTPS_CATALOG_SERVER to HTTPS_SERVER since that was how my default config.php file was set up.

 

I think I fixed this. The "HTTPS_SERVER . DIR_WS_HTTPS_CATALOG" references may be off for some people. Basically just make sure it references your secure catalog root.

 

My /phpbb2/config.php file looked nothing like what the instructions showed, but that may be because the instructions do not show the actual db name, password, server, etc. I just copied the top section from the replacement (from the if statement to the last require statement) in the instructions and pasted it in the top of my phpbb config file, and it worked for me.

My mistake, I used the modified values instead of the default values. Fixed it this go around.

 

My SQL statement in /phpbb2/login.php was longer than the one that the instructions showed, so I only replaced part of it.

Hmm..this query matches my default phpBB file exactly. I'm leaving as-is for now, it may be a version issue.

 

 

The instructions use .php as the extension for some of the tpl files, but I figured that out.

Fixed.

 

The instructions for /phpbb2/profile.php assume that the server is HTTPS, but mine isn't so I had to change from HTTPS to HTTP in some of the new code.

Yeah, it's mostly a security thing, making sure that they go into SSL mode when editing their account information. Without adding a check to ENABLE_SSL, I added a note to just change this variable if you need to.

 

That's about it.

 

I did a temp fix to get around the errors on login.php - I didn't paste in the new code, just left catalog/login.php as was. :-"

I did some testing after I installed, and when I logged in as myself in the catalog, a new user in phpbb was created. :thumbsup:

 

But I was not able to log in to phpbb after that, even as the admin. :blink:

It kept giving me an error - I forget what it was. This may be due to me not putting the code into catalog/login.php, or some other bug I introduced by making changes to your code.

 

HTH

 

I think I already mentioned this somewhere, but I fixed the ugly errors when trying to log in as the admin. Also, a note I just clarified, is that this mod changes the phpBB login to allow users to login with their e-mail address.

 

Thanks a LOT for your help! :D Caught a few issues I didn't when I initially started this.

 

As a side note, the new version is now uploaded: http://www.oscommerce.com/community/contributions,4710/

Link to comment
Share on other sites

Any1 has a demo running ?

 

No demo running yet, but I'll post a link when I do. (Don't hold your breath, tho'. :)

 

 

There's honestly not a whole lot of visible things to demo. The bottom line is you have a phpBB install and an osCommerce install; you create an account in osCommerce and an account is automatically set up in phpBB; you log into osCommerce and you're automatically logged into phpBB as well. It basically integrates forums into your shopping cart install so that users don't have to register for two different sections of your site, and therefore don't have to remember multiple login information for one website.

Link to comment
Share on other sites

Hi, everything seems to be working fine but when I try to access the forum admin from oscommerce, here is what I get....

HEADING_TITLE	 



If you see this page, there was a problem logging in to the forums. You can try to  or else re-check your settings.

Have tried going through the code but don't see any obvious errors. Any help or suggestions would be greatly appreciated. Thanks in advance

Link to comment
Share on other sites

I need some help. I am not following what I am suppose to be doing with this.

 

IMPORTANT: you MUST change GROUP_ID to the group ID # inserted by the above configuration_group insert.

 

INSERT INTO `configuration` (`configuration_id`, `configuration_title`, `configuration_key`, `configuration_value`, `configuration_description`, `configuration_group_id`, `sort_order`, `last_modified`, `date_added`, `use_function`, `set_function`) VALUES (NULL, 'Store URL', 'STORE_URL', '', 'The web address of my store (without ''http://'' and without the trailing slash).', '1', '2', NOW(), NOW(), NULL, NULL);

INSERT INTO `configuration` (`configuration_id`, `configuration_title`, `configuration_key`, `configuration_value`, `configuration_description`, `configuration_group_id`, `sort_order`, `last_modified`, `date_added`, `use_function`, `set_function`) VALUES (NULL, 'Slogan', 'STORE_SLOGAN', '', 'The slogan of your store or business.', '1', '2', NOW(), NOW(), NULL, NULL);

INSERT INTO `configuration_group` (`configuration_group_id`, `configuration_group_title`, `configuration_group_description`, `sort_order`, `visible`) VALUES (NULL, 'Forums', 'phpBB configuration', '99', '1');

#

# NOTE: you will probably want to change 'Administrator',

# '[email protected]', and 'YOUR_PASSWORD' below to match your actual phpBB

# login information.

# IMPORTANT: you MUST change GROUP_ID to the group ID # inserted by the abvoe

# configuration_group insert.

#

INSERT INTO `configuration` (`configuration_id`, `configuration_title`, `configuration_key`, `configuration_value`, `configuration_description`, `configuration_group_id`, `sort_order`, `last_modified`, `date_added`, `use_function`, `set_function`) VALUES (NULL, 'Forum Administrator Display Name', 'FORUM_USERNAME', 'Administrator', 'The displayed username of the forum's administrator.', GROUP_ID, '1', NOW(), NOW(), NULL, NULL);

INSERT INTO `configuration` (`configuration_id`, `configuration_title`, `configuration_key`, `configuration_value`, `configuration_description`, `configuration_group_id`, `sort_order`, `last_modified`, `date_added`, `use_function`, `set_function`) VALUES (NULL, 'Forum Administrator E-Mail', 'FORUM_USER_EMAIL', '[email protected]', 'The the forum's administrator e-mail address for correspondence.', GROUP_ID, '2', NOW(), NOW(), NULL, NULL);

INSERT INTO `configuration` (`configuration_id`, `configuration_title`, `configuration_key`, `configuration_value`, `configuration_description`, `configuration_group_id`, `sort_order`, `last_modified`, `date_added`, `use_function`, `set_function`) VALUES (NULL, 'Forum Administrator Password', 'FORUM_PASSWORD', MD5('YOUR_PASSWORD'), 'The forum administrator's password.', GROUP_ID, '3', NOW(), NOW(), NULL, NULL);

 

That is the SQL query that I am suppose to run. Can someone please tell me what I am suppose to change the GROUP_ID to.

 

I have spent many hours trying to get this to work, but with no luck.

 

Thanks in advance.

 

Jason

Link to comment
Share on other sites

I need some help. I am not following what I am suppose to be doing with this.

 

IMPORTANT: you MUST change GROUP_ID to the group ID # inserted by the above configuration_group insert.

That is the SQL query that I am suppose to run. Can someone please tell me what I am suppose to change the GROUP_ID to.

 

I have spent many hours trying to get this to work, but with no luck.

 

Thanks in advance.

 

Jason

 

When you run the first SQL statement, the last insert creates a new configuration_group:

 

INSERT INTO `configuration_group` (`configuration_group_id`, `configuration_group_title`, `configuration_group_description`, `sort_order`, `visible`) VALUES (NULL, 'Forums', 'phpBB configuration', '99', '1');

 

When you run that insert statement, MySQL will return the record ID # of your new configuration_group. You can alternatively search for it, if you've already run the statement:

 

SELECT configuration_group_id FROM configuration_group WHERE configuration_group_title LIKE 'Forums'

 

That should return the id # that you use for the remaining inserts.

Link to comment
Share on other sites

Hi, everything seems to be working fine but when I try to access the forum admin from oscommerce, here is what I get....
HEADING_TITLE	 



If you see this page, there was a problem logging in to the forums. You can try to  or else re-check your settings.

Have tried going through the code but don't see any obvious errors. Any help or suggestions would be greatly appreciated. Thanks in advance

 

Basically what it sounds like is, the login page isn't finding your admin username/login in the phpBB users database. This is probably because the username/password combination in the osC bridge doesn't match what you used to set up phpBB2.

 

Try opening up /catalog/admin/forum_admin_login.php and right BEFORE line 11 ("if(tep_db_num_rows($adminCheck)) {") add this line:

echo $adminCheck;

 

Then try logging in again. It will give you a SQL statement on-screen. Run that SQL statement manually through phpMyAdmin and see what it returns. If it returns no rows, that means your osC configuration doesn't match your phpBB configuration, and you just need to change the administrator login information in each so that they do match. If it returns 1 row, then there's some other reason you're not being logged in. Let me know what happens. :)

Link to comment
Share on other sites

When you run the first SQL statement, the last insert creates a new configuration_group:

 

INSERT INTO `configuration_group` (`configuration_group_id`, `configuration_group_title`, `configuration_group_description`, `sort_order`, `visible`) VALUES (NULL, 'Forums', 'phpBB configuration', '99', '1');

 

When you run that insert statement, MySQL will return the record ID # of your new configuration_group. You can alternatively search for it, if you've already run the statement:

 

SELECT configuration_group_id FROM configuration_group WHERE configuration_group_title LIKE 'Forums'

 

That should return the id # that you use for the remaining inserts.

database.jpg

 

This is what I see. Do I use 16 or 18? I used 18 in my insert query and it seemed to work. But now I have the same problem as FHCeramics with the admin login. I used the echo $adminCheck; and get "Resource id #26" in the top left of my screen.

 

Any ideas?

Link to comment
Share on other sites

database.jpg

 

This is what I see. Do I use 16 or 18? I used 18 in my insert query and it seemed to work. But now I have the same problem as FHCeramics with the admin login. I used the echo $adminCheck; and get "Resource id #26" in the top left of my screen.

 

Any ideas?

 

Looks like you might have duplicate entries in your config groups. Try that same query except with SELECT * instead of SELECT configuration_group_id

 

 

And I misspoke. instead of echo $adminCheck do:

echo "SELECT * FROM ".TABLE_PHPBB_USERS." WHERE username='".FORUM_USERNAME."' AND user_password=MD5('".FORUM_PASSWORD."') AND user_email='".FORUM_USER_EMAIL."'";

 

 

Make sure that the username, password, and e-mail that the query returns match your phpBB install.

Link to comment
Share on other sites

Hello, have tried your suggestion and been playing around with it a bit. The problem seems to be in the phpBB section, at least in mine as the user name and password are correct and match both sides, but even trying to login from the phpBB side, it will not recognize the user name for logging in, it will only accept the email addy for the login?

Link to comment
Share on other sites

Can someone please tell me where you put the GROUP_ID ?

 

I run the statement mentioned above :

SELECT configuration_group_id FROM configuration_group WHERE configuration_group_title LIKE 'Forums'

 

and see :

 

osc.jpg

 

and I get "16" but am I supposed to put that into all three lines of the following :

 

INSERT INTO `configuration` (`configuration_id`, `configuration_title`, `configuration_key`, `configuration_value`, `configuration_description`, `configuration_group_id`, `sort_order`, `last_modified`, `date_added`, `use_function`, `set_function`) VALUES (NULL, 'Forum Administrator Display Name', 'FORUM_USERNAME', 'r***s', 'The displayed username of the forum's administrator.', GROUP_ID, '16', NOW(), NOW(), NULL, NULL);

INSERT INTO `configuration` (`configuration_id`, `configuration_title`, `configuration_key`, `configuration_value`, `configuration_description`, `configuration_group_id`, `sort_order`, `last_modified`, `date_added`, `use_function`, `set_function`) VALUES (NULL, 'Forum Administrator E-Mail', 'FORUM_USER_EMAIL', 'ro*************.uk', 'The the forum's administrator e-mail address for correspondence.', GROUP_ID, '16', NOW(), NOW(), NULL, NULL);

INSERT INTO `configuration` (`configuration_id`, `configuration_title`, `configuration_key`, `configuration_value`, `configuration_description`, `configuration_group_id`, `sort_order`, `last_modified`, `date_added`, `use_function`, `set_function`) VALUES (NULL, 'Forum Administrator Password', 'FORUM_PASSWORD', MD5('*****'), 'The forum administrator's password.', GROUP_ID, '16', NOW(), NOW(), NULL, NULL);

 

because if I do i get the following error :

 

osc2.jpg

Edited by rossoe
Link to comment
Share on other sites

Hello, have tried your suggestion and been playing around with it a bit. The problem seems to be in the phpBB section, at least in mine as the user name and password are correct and match both sides, but even trying to login from the phpBB side, it will not recognize the user name for logging in, it will only accept the email addy for the login?

 

One work-around would be to change /phpbb2/login.php. Change the login query to:

 

		// Added for phpBB-osCommerce Bridge
	//$sql = "SELECT user_id, username, user_password, user_active, user_level
	//	FROM " . USERS_TABLE . "
	//	WHERE username = '" . str_replace("\\'", "''", $username) . "'";
	$sql = "SELECT user_id, username, user_password, user_active, user_level
		FROM " . USERS_TABLE . "
		WHERE user_password = '$password_select' AND (user_email = '" . str_replace("\\'", "''", $email) . "' OR username = '" . str_replace("\\'", "''", $email) . "')";
	// End phpBB-osCommerce Bridge

 

That should check the login authorization for either a matching e-mail address or username (the $email in the username= part isn't a typo, $email = whatever you typed in the login box).

 

Other than that, I'm not sure why it's not working for you. :( Anybody else having this issue?

Link to comment
Share on other sites

INSERT INTO `configuration` (`configuration_id`, `configuration_title`, `configuration_key`, `configuration_value`, `configuration_description`, `configuration_group_id`, `sort_order`, `last_modified`, `date_added`, `use_function`, `set_function`) VALUES (NULL, 'Forum Administrator Display Name', 'FORUM_USERNAME', 'r***s', 'The displayed username of the forum's administrator.', GROUP_ID, '16', NOW(), NOW(), NULL, NULL);
INSERT INTO `configuration` (`configuration_id`, `configuration_title`, `configuration_key`, `configuration_value`, `configuration_description`, `configuration_group_id`, `sort_order`, `last_modified`, `date_added`, `use_function`, `set_function`) VALUES (NULL, 'Forum Administrator E-Mail', 'FORUM_USER_EMAIL', 'ro*************.uk', 'The the forum's administrator e-mail address for correspondence.', GROUP_ID, '16', NOW(), NOW(), NULL, NULL);
INSERT INTO `configuration` (`configuration_id`, `configuration_title`, `configuration_key`, `configuration_value`, `configuration_description`, `configuration_group_id`, `sort_order`, `last_modified`, `date_added`, `use_function`, `set_function`) VALUES (NULL, 'Forum Administrator Password', 'FORUM_PASSWORD', MD5('*****'), 'The forum administrator's password.', GROUP_ID, '16', NOW(), NOW(), NULL, NULL);

 

I just realized you may also be having a problem because the character escaping is off on those statements.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...