Post by distracted » Sun Jan 16, 2011 9:13 am

Has anyone integrated pbpBB with OpenCart. I would like to have the top section of the website common with pbpBB so users can quickly flip between cart, Forum, and also Blog.

New member

Posts

Joined
Mon Aug 03, 2009 8:01 am

Post by SXGuy » Wed Feb 02, 2011 6:22 pm

I too am looking for some advise on intergration with phpbb3, im not really fussed about intergrating the whole thing inside opencart, because i can live with it being external and just modify the css to look similar.

What i do wish to know, is if anyone has any idea on how phpbb3 uses a session token or similar to check if someone is logged in.

I have installed phpbb3 in a seperate folder called /forum for which i will place a link inside my shop.

I have installed the database into the same mysql database as the shop with using a prefix of phpbb_

I will look into modifying opencarts register and login files to add the function to place the same details inside phpbb user database table, thats fine, and probably easy, im sure they both use the same encoding.

But i have a feeling that phpbb will use some sort of session cookie to check if a user is logged in, and id need to pass that when a user clicks the forum link.

Has anyone had alot of expierence with phpbb that they can share with me about session tokens?

Active Member

Posts

Joined
Sun Nov 08, 2009 2:07 am

Post by SXGuy » Fri Feb 04, 2011 10:52 pm

bit of an update.

i have managed to sucessfully get opencart to register a user for phpbb at the same time, process of editing details etc would be the same.

One problem i came across, is the way that phpbb hashes its passwords, it no longer just uses MD5 but has its own hash function

Code: Select all

	function phpbb_hash($password) {
   $itoa64 = './0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz';
   $random_state = unique_id();
   $random = '';
   $count = 6;

   if (($fh = @fopen('/dev/urandom', 'rb')))
   {
      $random = fread($fh, $count);
      fclose($fh);
   }

   if (strlen($random) < $count)
   {
      $random = '';

      for ($i = 0; $i < $count; $i += 16)
      {
         $random_state = md5(unique_id() . $random_state);
         $random .= pack('H*', md5($random_state));
      }
      $random = substr($random, 0, $count);
   }

   $hash = _hash_crypt_private($password, _hash_gensalt_private($random, $itoa64), $itoa64);

   if (strlen($hash) == 34)
   {
      return $hash;
   }

   return md5($password);
}
just so people know, how i got opencart to register a user on phpbb is as follows.

Firstly, i have opencart installed in the root directory, and phpbb stored in a subdirectory called "forum"

I installed phpbb into the same database as opencart, but used a prefix called phpbb_

in catalog/model/account/customer

find

Code: Select all

public function addCustomer($data) { 
insert before the last }

Code: Select all

$this->db->query("INSERT INTO phpbb_users SET username = '" . $this->db->escape($data['email']) . "', user_password = '" . $this->db->escape(phpbb_hash($data['password'])) . "', group_id = '2', user_timezone = '1.00', user_dst = '0', user_lang = 'en', user_type = '0', user_dateformat = 'd M Y H:i', user_style = '1', user_regdate = ''");
notice, that i replaced username with email address as opencart doesnt have a username field (one can be easily added at a later date, but not required for testing purposes)

Now, everything here in the query is all you need to create an account with phpbb BUT, notice phpbb_hash($data['password']))

phpbb_hash() needs to be included somwhere for which i have given the code above.

I am having trouble working out where to place it and how to use it.

unique_id() is also a function which needs to be addressed

I hope i have given someone enough info needed to be able to help with this project!!!!

Active Member

Posts

Joined
Sun Nov 08, 2009 2:07 am

Post by SXGuy » Sat Feb 05, 2011 6:48 pm

Another update.

Managed to track down a standalone verson of phpbb3 registration process.

This in theory is all you need to register someone at the same time, providing you call it inside the controller/account/customer.php

One major problem is there are alot of refencs to PEAR functions which are causing major issues.

My opinion it needs a massive re-write, beyond my scope, but the concept is all there for someone to work with.

If anyone is interested in getting it to work, they may find themselves with there very own opencart - phpbb3 bridge.

Would love to know if anyone manages it.

Active Member

Posts

Joined
Sun Nov 08, 2009 2:07 am

Post by nhymxu » Mon Nov 19, 2012 10:59 pm

can you write full tutorial step by step :(
or create exten :(

Newbie

Posts

Joined
Mon Nov 19, 2012 9:09 pm
Who is online

Users browsing this forum: No registered users and 4 guests