Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

[Contribution] phpBB-osCommerce Bridge


gabrielk

Recommended Posts

Let me make sure I'm understanding you correctly.

 

Are you saying: a user visits the shopping cart, logs in via osC, and then visits the forums and everything is OK. But if a user visits the forums, then visits osC and logs in, they are not properly logged into the forums? This would be a bug and I'd have to dig around to see what the problem is.

 

Or are you saying: a user logs into the forums via phpBB, and when they visit the shopping cart they are not logged into osC? If so, then this is the intended behaviour.

The idea here is to make is as seamless as possible. When you allow users to choose their own username, you open up a whole floodgate of new issues and possibilities. For example, what if a user doesn't specifically want a forum account? They will be annoyed and possibly abandon their sale if they are required to choose a forum username with no way to opt out; but take away the option and most people won't care, it will just be another feature they may or may not use (or even know about). You also then have to monitor against inappropriate usernames, which is just one more step for an already busy store owner.

 

o.k. if a user logs on to the OSc shop thats logs in fine, when they click on the link to the forums it does not automaticaly log them in. they have to log in to the forum Separately.

 

Now upon further investigation I have noticed that when the user logs into the shop a session key is created in the PHPBB_sessions table. with an encoded IP address. now when the user clicks on the link to the PHPBB forum they have a standard index page asking them to logon. At this point another session key is created but the encoded ip address is different. which is why the passthrough login process is not working. this seems to only happen to people who have isp thats uses a proxy server and that proxy header is detected. for some reason the shop seems to record the proxy ip address and the PHPBB login process records the user IP address, which is why I assume you have to login to the forum to gain access.

 

The intergration works fine for people who dont use a proxy server now the weird thing is that I'm with an ISP that uses a proxy server but for some reason it works o.k. for me it seems to only cause problems if the proxy ip address is deteced in the HTTP headers. a quick way of fining it is to use one of this website that detcts your ip address and proxy server.

 

http://www.ioerror.us/ip/

 

I hope this make sense

Link to comment
Share on other sites

  • Replies 149
  • Created
  • Last Reply

Top Posters In This Topic

to resolve this problem i have done the following but please correct if this is total crap but it seems to have sorted out this problem form me.

 

change the follwoing in catalog/login.php

 

f($check_bbusers_query['user_level']==1) {

$admin='1';

} else {

$admin='0';

}

session_begin($customer_id, encode_ip(tep_get_ip_address()), PAGE_INDEX, FALSE, $autologin, $admin);

 

 

to this

 

 

if($check_bbusers_query['user_level']==1) {

$admin='1';

} else {

$admin='0';

}

$client_ip2 = ( !empty($HTTP_SERVER_VARS['REMOTE_ADDR']) ) ? $HTTP_SERVER_VARS['REMOTE_ADDR'] : ( ( !empty($HTTP_ENV_VARS['REMOTE_ADDR']) ) ? $HTTP_ENV_VARS['REMOTE_ADDR'] : getenv('REMOTE_ADDR') );

 

session_begin($customer_id, encode_ip($client_ip2), PAGE_INDEX, FALSE, $autologin, $admin);

 

thsi seems to reolve my issue but I'm not to sure what other problems this may cause

Link to comment
Share on other sites

Hi, I have fixed a bunch of little problems I came apon with this installation, but I don't really know what to do about this one. when I try to create a new account in osC I get this Error:

 

Fatal error: Call to undefined function: session_begin() in /home/content/h/e/s/hesawatart/html/catalog/create_account.php on line 241

 

which points to this line in the code.

 

session_begin($customer_id, encode_ip(tep_get_ip_address()), PAGE_INDEX, FALSE, $autologin, 0);

 

the database gets updated in the customers section with the new user as well in the phbb_users but not the address book. any idea how to fix this issue?

 

thanks,

Will Dupré

Link to comment
Share on other sites

Hi, I have fixed a bunch of little problems I came apon with this installation, but I don't really know what to do about this one. when I try to create a new account in osC I get this Error:

which points to this line in the code.

 

session_begin($customer_id, encode_ip(tep_get_ip_address()), PAGE_INDEX, FALSE, $autologin, 0);

 

the database gets updated in the customers section with the new user as well in the phbb_users but not the address book. any idea how to fix this issue?

 

thanks,

Will Dupré

 

 

give this a go see what happens

 

session_begin($customer_id, encode_ip(tep_get_ip_address()), PAGE_INDEX, FALSE, $autologin, 0);

 

and replace with

 

// session_begin($customer_id, encode_ip(tep_get_ip_address()), PAGE_INDEX, FALSE, $autologin, 0);

 

see if the account get created

Edited by Optimalkiller
Link to comment
Share on other sites

give this a go see what happens

 

session_begin($customer_id, encode_ip(tep_get_ip_address()), PAGE_INDEX, FALSE, $autologin, 0);

 

and replace with

 

// session_begin($customer_id, encode_ip(tep_get_ip_address()), PAGE_INDEX, FALSE, $autologin, 0);

 

see if the account get created

 

Thanks Optimalkiller yeah that fixes the issue though not sure what it breaks, <_<

now I am just having problems with some of the code from the STS Mod to figure out and I will be good to go.

Link to comment
Share on other sites

Hi everyone,

i need help with this contrib. i did everything as instructed (i think) but i don't know how to log in as admin. in my database for the oscommerce table i only have the default 1 customer named john doe. his customer id is 1. for the phpbb user table there is 2 users. one is anonymous with id -1 and the other is admin with id 2.

 

in my oscommerce admin there is a link that says forum admin which is suppose to take me to the forum admin index page but when i click it i am taken to my store homepage and asked to log in. i don't know what to put in. i tried putting in the email address and password that was setup when i first installed the forum but it's saying that there is no match for email address and password.

 

when i try to login via the forum at the bottom of the page and put in the email address and password i am taken back to my store home page and asked to login. i get the same error saying no match.

 

can someone please tell me what i am doing wrong? do i have to create a customer account for myself and make that id2?

i don't understand this part of the instructions:

 

If you didn't have any customer account, now it is a good time to create one for yourself, to make the #2 customer_id account as the admin user_id #2 in phpBB later.

 

if i create a customer account, how do i make it #2 if i can't log into phpbb admin? i'm confused.

 

i have been at this for a couple of days now and i have searched everywhere to fix this problem.

 

thanks

7:)

 

the part that creates the admin account is at the very beginning of the instructions where it says how to modify the database. if you dont have that you wont have a linked admin account.

Link to comment
Share on other sites

Thanks Optimalkiller yeah that fixes the issue though not sure what it breaks, <_<

now I am just having problems with some of the code from the STS Mod to figure out and I will be good to go.

 

that line of code should only been in the login.php and not in the create_account.php so as far as I'm aware it should not break anything :)

Link to comment
Share on other sites

that line of code should only been in the login.php and not in the create_account.php so as far as I'm aware it should not break anything :)

 

 

Well, I checked the original script at it does have that line of code in the create_account.php, this particular line of coding is getting the unique customer id and IP address of the user and putting that into the session table, I assume what this is doing is allowing the user upon creating an account to be automatically logged on to the Shop and the Forum. takeing that line out will stop the user from being logged on to the shop/Forum once the account has been created.

Edited by Optimalkiller
Link to comment
Share on other sites

to resolve this problem i have done the following but please correct if this is total crap but it seems to have sorted out this problem form me.

 

change the follwoing in catalog/login.php

 

f($check_bbusers_query['user_level']==1) {

$admin='1';

} else {

$admin='0';

}

session_begin($customer_id, encode_ip(tep_get_ip_address()), PAGE_INDEX, FALSE, $autologin, $admin);

to this

if($check_bbusers_query['user_level']==1) {

$admin='1';

} else {

$admin='0';

}

$client_ip2 = ( !empty($HTTP_SERVER_VARS['REMOTE_ADDR']) ) ? $HTTP_SERVER_VARS['REMOTE_ADDR'] : ( ( !empty($HTTP_ENV_VARS['REMOTE_ADDR']) ) ? $HTTP_ENV_VARS['REMOTE_ADDR'] : getenv('REMOTE_ADDR') );

 

session_begin($customer_id, encode_ip($client_ip2), PAGE_INDEX, FALSE, $autologin, $admin);

 

thsi seems to reolve my issue but I'm not to sure what other problems this may cause

 

Interesting! What you're doing there makes sense, since all I'm trying to do is grab the ip address. If that fixed the issue for you, I'll make sure and add it in another revision. I'm definitely not the best at this. :)

Link to comment
Share on other sites

Well, I checked the original script at it does have that line of code in the create_account.php, this particular line of coding is getting the unique customer id and IP address of the user and putting that into the session table, I assume what this is doing is allowing the user upon creating an account to be automatically logged on to the Shop and the Forum. takeing that line out will stop the user from being logged on to the shop/Forum once the account has been created.

 

Correct. If the error the person was getting said:

Fatal error: Call to undefined function: session_begin() in /home/content/h/e/s/hesawatart/html/catalog/create_account.php on line 241

Then I would guess the problem is one of three things: the path to the phpBB include file is incorrect, or is missing from this file. Make sure you're getting all the included files on the page, basically, since session_begin() is a function from the phpBB session file.

Link to comment
Share on other sites

Hello.

Does this contribution makes phpbb open inside OSC?

I just could create the bridge... but what I really want is to open it inside. Any way of doing this?

 

Thank you

 

This is possible, but really, really not recommended. You essentially have to modify every phpBB page. This would be fine if it were a one-time thing, but it seems every few months phpBB releases another version or a critical patch. I would look into Chavire's old 2.0.8 integration and use that as a template for the latest version of phpBB.

Link to comment
Share on other sites

Correct. If the error the person was getting said:

 

Then I would guess the problem is one of three things: the path to the phpBB include file is incorrect, or is missing from this file. Make sure you're getting all the included files on the page, basically, since session_begin() is a function from the phpBB session file.

 

OK where on the page is the path to the phpBB include file indicated? I am not clear on what you mean by this.

Link to comment
Share on other sites

Interesting! What you're doing there makes sense, since all I'm trying to do is grab the ip address. If that fixed the issue for you, I'll make sure and add it in another revision. I'm definitely not the best at this. :)

 

No your doing a fantatic Job keep up the good work. Looking forward to your next revision. :)

 

Thanks for a wonderfull Mod for the PHPBB Intergration.

Link to comment
Share on other sites

OK where on the page is the path to the phpBB include file indicated? I am not clear on what you mean by this.

 

 

Do the following.

 

#-----[ OPEN ]------------------------------------------------------------------

#

/catalog/create_account.php

#

#-----[ FIND ]------------------------------------------------------------------

#

require('includes/application_top.php');

#

#-----[ BEFORE, ADD ]-----------------------------------------------------------

#

# Note that you have to manually enter your acutal RELATIVE phpBB path again,

# since this chunk of code takes place before we define any variables.

#

// Added for phpBB-osCommerce Bridge

define("IN_LOGIN", true);

define('IN_PHPBB', true);

$phpbb_root_path = './phpbb2';

include($phpbb_root_path . 'extension.inc');

include($phpbb_root_path . 'common.'.$phpEx);

// End phpBB-osCommerce Bridge

 

This should resolve your issue!!!!! also you must specify your forum location!!!!! in the line thats been marked in Bold

 

Regards

 

Optimal

Edited by Optimalkiller
Link to comment
Share on other sites

Do the following.

 

#-----[ OPEN ]------------------------------------------------------------------

#

/catalog/create_account.php

#

#-----[ FIND ]------------------------------------------------------------------

#

require('includes/application_top.php');

#

#-----[ BEFORE, ADD ]-----------------------------------------------------------

#

# Note that you have to manually enter your acutal RELATIVE phpBB path again,

# since this chunk of code takes place before we define any variables.

#

 

This should resolve your issue!!!!! also you must specify your forum location!!!!! in the line thats been marked in Bold

 

Regards

 

Optimal

 

ah thanks Optimal, that did the trick :) though that bit of code needed to be fixed with a / after phpbb2 so the code should go:

 

// Added for phpBB-osCommerce Bridge
 define("IN_LOGIN", true);
 define('IN_PHPBB', true);
 $phpbb_root_path = './phpbb2/';
 include($phpbb_root_path . 'extension.inc');
 include($phpbb_root_path . 'common.'.$phpEx);
 // End phpBB-osCommerce Bridge

 

I noticed this discrepency elswhere in the instructions.

Link to comment
Share on other sites

OK, Seems like a great contribution and I am sure it will be amazing once I get it installed, but I can not seem to get it to work for the life of me. I have version 1.3 and I think I installed everthing properly, but first off I believe I am having an sql error below when logging in.

 

1146 - Table 'cworks_osc1.phpbb_users' doesn't exist

 

SELECT count(*) AS count FROM phpbb_users WHERE username LIKE 'coltons%'

 

I tried to modify the code to the best of my ability to keep the full first and last name as the username for the forum. I changed the codes to

 

$new_username = strtolower($customers_firstname) . strtolower($customers_lastname)

 

I did this wherever I saw the code change to be necessary. I also always seem to get a

 

Error: No match for E-Mail Address and/or Password.

error while trying to log in. I also have had problems logging into my forum. I dont know why, but I must have done something wrong. I just seem to have too many problems. Maybe I am having code coma from looking at code for the last 6 hours. Maybe there have been changes that have not been uploaded yet.

 

I would appreciate anybody's input. I know that I really havent explained too much and will probably give another shot at trying to install. My forum is on my site in the /forum directory, I could have missed some little subtle changes. One of my main things was trying to figure out how to get first and last name forum usernames.

Link to comment
Share on other sites

Sorry about the double post but I just tried a reinstall. Things seem to be going a lot smoother. One issue I am having is that when I am trying to create a new account I get the error:

Fatal error: Call to undefined function session_begin() in /home/cworks/public_html/create_account.php on line 238

I am not sure what to do about that. Here is my line 238:

session_begin($customer_id, encode_ip(tep_get_ip_address()), PAGE_INDEX, FALSE, $autologin, 0);

The account is made and the forum account is made. It works as it should but they still get the error.

 

Also, whenever I log in to my OSCommerce, it automatically logs me to the forum admin, even though I have my own account (forum admin which is my full name) with my name and corresponding email address which I use as the forum admin. I am the number 3 user and the "Admin" user is number 2 like usual. Any way to fix this?

What also happens is that we have 17 customers who signed up before the bridge. We tried logging in one through the website but the forum would not log them in automatically.

 

One last question, how would I manipulate the code from:

$new_username = strtolower($check_customer['customers_firstname']) . strtolower($check_customer['customers_lastname']);

to add a space inbetween the first and last names?

 

Thanks for your time guys!

Edited by Trevor51590
Link to comment
Share on other sites

Again sorry for the triple post but the last thing I noticed:

 

On the new account that I was able to make, I tried changing the email address. It changed properly on both sides but the forum name switched to "username2". After this i could change the email address an infinite amount of times and it would still stay on the 'username2" without counting up. It would be optimal if a user could change their email address and have their username stay the same.

 

Thanks and sorry!

Link to comment
Share on other sites

Hey, I've been using this contribution for a while now but today I installed SEO urls version 2.0. The reason for installing 2.0 and not 2.1X is because the 2.1 code messed up the affiliate system and the "super download store" contribution.

Anyways I get a little problem with this code now when SEO is installed. In your install files theres a part for the SEO mod but I think thats for the newer code (the 2.1+ SEO mod) and that code is recoded so the SEO 2.0 is kinda much different:

 

When going to login or create account I get this message:

Fatal error: Cannot redeclare class cache in /hsphere/local/home/grevinn0/din-shop.se/includes/classes/cache.class.php on line 33

 

Im almost 100% sure it means something like cannot check the class twice (I can be wrong here) but the reason I get this error is because I have this code in login and create_account:

  // Added for phpBB-osCommerce Bridge
 define("IN_LOGIN", true);
 define('IN_PHPBB', true);
 $phpbb_root_path = './forum/';
 include($phpbb_root_path . 'extension.inc');
 include($phpbb_root_path . 'common.'.$phpEx);
 // End phpBB-osCommerce Bridge

 

I checked the install files and the solution for the newer SEO mod would be to rewrite this code in SEO.class:

$_sid = $this->SessionName() . '=' . $this->SessionID();

to

$_sid = 'osCsid=' . $this->SessionID();

 

 

But as I dont use SEO.class.php I have the same code in html_output.php so I changed:

 if (HTTP_COOKIE_DOMAIN != HTTPS_COOKIE_DOMAIN) {
	  $_sid = tep_session_name() . '=' . tep_session_id();
	}

to

 if (HTTP_COOKIE_DOMAIN != HTTPS_COOKIE_DOMAIN) {
					// Added for phpBB-osCommerce Bridge
		  // $_sid = $this->SessionName() . '=' . $this->SessionID();
		  $_sid = 'osCsid=' . $this->SessionID();
		  // End phpBB-osCommerce Bridge

	}

 

But that didnt do the trick and I still get the same Fatal error. Do you have any ideas on what I need to change to get this to work?

Edited by Dennis_gull
Link to comment
Share on other sites

Sorry about the double post but I just tried a reinstall. Things seem to be going a lot smoother. One issue I am having is that when I am trying to create a new account I get the error:

 

I am not sure what to do about that. Here is my line 238:

session_begin($customer_id, encode_ip(tep_get_ip_address()), PAGE_INDEX, FALSE, $autologin, 0);

The account is made and the forum account is made. It works as it should but they still get the error.

 

Thanks for your time guys!

 

Do the following.

 

#-----[ OPEN ]------------------------------------------------------------------

#

/catalog/create_account.php

#

#-----[ FIND ]------------------------------------------------------------------

#

require('includes/application_top.php');

#

#-----[ BEFORE, ADD ]-----------------------------------------------------------

#

# Note that you have to manually enter your acutal RELATIVE phpBB path again,

# since this chunk of code takes place before we define any variables.

#

// Added for phpBB-osCommerce Bridge

define("IN_LOGIN", true);

define('IN_PHPBB', true);

$phpbb_root_path = './phpbb2';

include($phpbb_root_path . 'extension.inc');

include($phpbb_root_path . 'common.'.$phpEx);

// End phpBB-osCommerce Bridge

 

This should resolve your issue!!!!! also you must specify your forum location!!!!! in the line thats been marked in Bold

 

Regards

 

Optimal

Link to comment
Share on other sites

Thanks Optimalkiller! Maybe you can help me with my next problem. How would I manipulate this code to create a space between the first and last names of the forum username?

$new_username = "strtolower($firstname) . strtolower($lastname)";

 

Thanks!

 

Do the following.

 

#-----[ OPEN ]------------------------------------------------------------------

#

/catalog/create_account.php

#

#-----[ FIND ]------------------------------------------------------------------

#

require('includes/application_top.php');

#

#-----[ BEFORE, ADD ]-----------------------------------------------------------

#

# Note that you have to manually enter your acutal RELATIVE phpBB path again,

# since this chunk of code takes place before we define any variables.

#

// Added for phpBB-osCommerce Bridge

define("IN_LOGIN", true);

define('IN_PHPBB', true);

$phpbb_root_path = './phpbb2';

include($phpbb_root_path . 'extension.inc');

include($phpbb_root_path . 'common.'.$phpEx);

// End phpBB-osCommerce Bridge

 

This should resolve your issue!!!!! also you must specify your forum location!!!!! in the line thats been marked in Bold

 

Regards

 

Optimal

Link to comment
Share on other sites

Quick update-

 

Turns out adding the line of code to my create_account.php gives me this error now upon account creation:

 

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/cworks/public_html/includes/functions/database.php on line 99

Warning: Cannot modify header information - headers already sent by (output started at /home/cworks/public_html/includes/functions/database.php:99) in /home/cworks/public_html/includes/functions/general.php on line 33

Edited by Trevor51590
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...