[SUPPORT] PunBB to phpBB convertor

This is an archive of the phpBB 2.0.x convertors forum. Support for phpBB2 has now ended.
Forum rules
Following phpBB2's EoL, this forum is now archived for reference purposes only.
Please see the following announcement for more information: viewtopic.php?f=14&t=1385785
User avatar
D¡cky
Former Team Member
Posts: 11812
Joined: Tue Jan 25, 2005 8:38 pm
Location: New Hampshire, USA
Name: Richard Foote
Contact:

[SUPPORT] PunBB to phpBB convertor

Post by D¡cky » Tue Jun 14, 2005 4:51 am

I have made available a convertor for PunBB 1.1.x and 1.2.x to phpBB.

For the 1.25 conversion:
All groups, moderator setups, and permissions do convert properly. If for some reason something does not convert properly, you should be able to set in the ACP. Or ask in this topic.

PunBB 1.2.5 convertor Version 2 (Beta 0.1.2) Download
PunBB 1.1.x convertor Version 1.0.3 Download
Last edited by D¡cky on Fri Jun 09, 2006 8:26 pm, edited 11 times in total.
Have you hugged someone today?

marsh lagoon
Registered User
Posts: 19
Joined: Mon Dec 06, 2004 1:32 am
Contact:

Re: [SUPPORT] PunBB to phpBB convertor

Post by marsh lagoon » Fri Jun 17, 2005 3:30 pm

D¡cky wrote: Edit: I am having server problems at the moment. Should be backup in a day or so.

I'm interested in giving this one a try. Please let us know when you have your server problems squared away.
Image

User avatar
D¡cky
Former Team Member
Posts: 11812
Joined: Tue Jan 25, 2005 8:38 pm
Location: New Hampshire, USA
Name: Richard Foote
Contact:

Re: [SUPPORT] PunBB to phpBB convertor

Post by D¡cky » Fri Jun 17, 2005 11:55 pm

marsh lagoon wrote:
D¡cky wrote:Edit: I am having server problems at the moment. Should be backup in a day or so.

I'm interested in giving this one a try. Please let us know when you have your server problems squared away.

Should be all set now!
Have you hugged someone today?

moitio
Registered User
Posts: 1
Joined: Wed Mar 30, 2005 8:22 pm
Location: Stockport, UK
Contact:

Buggy on my version

Post by moitio » Sat Jun 18, 2005 3:04 pm

I did it on the most recent version of punbb. My biggest complaints are some of the table name entry thingys weren't defined, and the code rehashed all the passwords. Also it got the status column wrong. If you don't mind I'll rework the code so it works for Punbb 1.2.5 and I'll send you the code.

Thanks, Moitio
Moitio.com

User avatar
D¡cky
Former Team Member
Posts: 11812
Joined: Tue Jan 25, 2005 8:38 pm
Location: New Hampshire, USA
Name: Richard Foote
Contact:

Re: Buggy on my version

Post by D¡cky » Sat Jun 18, 2005 3:39 pm

moitio wrote: I did it on the most recent version of punbb. My biggest complaints are some of the table name entry thingys weren't defined, and the code rehashed all the passwords. Also it got the status column wrong. If you don't mind I'll rework the code so it works for Punbb 1.2.5 and I'll send you the code.

Thanks, Moitio

Thanks. I appreciate any help and feedback.

As for the passwords, phpBB and PunBB use a different encryption schemes. There is no way, as far as I know, to transfer them so that they are usable.
Have you hugged someone today?

geepee
Registered User
Posts: 2
Joined: Tue Jun 21, 2005 11:30 pm
Location: Saint John, NB
Contact:

Post by geepee » Tue Jun 21, 2005 11:32 pm

any progress on a convertor for punbb 1.2.x -> phpbb2?

User avatar
D¡cky
Former Team Member
Posts: 11812
Joined: Tue Jan 25, 2005 8:38 pm
Location: New Hampshire, USA
Name: Richard Foote
Contact:

Post by D¡cky » Wed Jun 22, 2005 3:04 am

Yes, there is progress

Users, posts, topics, forums and categories convert

Still needed to program for conversion:
Groups, moderator setups, and permissions. Moderators do convert, but they are set to moderate all forums, not just the particular forums they moderated on PunBB

If you want to try the conversion, you are welcome to give it a go. Whatever does not convert properly, you should be able to set in the ACP.

Download alpha version 0.0.1
Have you hugged someone today?

geepee
Registered User
Posts: 2
Joined: Tue Jun 21, 2005 11:30 pm
Location: Saint John, NB
Contact:

Post by geepee » Wed Jun 22, 2005 11:02 am

It worked pretty good. Not complete though, but here's a few things I noticed:

If you don't have punBB with a prefix, and you specify $pun_prefix = ""; in conf.php, it still assumes punbb_ is the prefix for your tables.

After the conversion, I wasn't able to login...

PHP scripts on my host time out after 15s of execution (I was able to work around that by pruning the database). Not really a problem with the script, but just bringing it up anyway.

Nice work!

marsh lagoon
Registered User
Posts: 19
Joined: Mon Dec 06, 2004 1:32 am
Contact:

Post by marsh lagoon » Tue Jul 05, 2005 1:44 am

geepee wrote: After the conversion, I wasn't able to login...

I had the same problem. I had to use the password recovery feature. Also I think the script might've deleted the Guest account in my punbb_users table, which was also fixable.

This was with v2, I'm going to give v3 a try now.
Image

User avatar
D¡cky
Former Team Member
Posts: 11812
Joined: Tue Jan 25, 2005 8:38 pm
Location: New Hampshire, USA
Name: Richard Foote
Contact:

Post by D¡cky » Tue Jul 05, 2005 2:17 am

[quote="marsh lagoon"]
[quote="geepee"]After the conversion, I wasn't able to login...
[/quote]
I had the same problem. I had to use the password recovery feature.[/quote]
This is normal. PunBB and phpBB use different encryption methods for their passwords. There is no way to decrypt the PunBB password and convert it over to phpBB. All your users will have to use the password recovery feature.

[quote="marsh lagoon"]
Also I think the script might've deleted the Guest account in my punbb_users table, which was also fixable.

This was with v2, I'm going to give v3 a try now.
[/quote]
Yes, the convertor does delete the PunBB guest account. Now that you mention it, this is not such a good idea. I will fix that.

User avatar
sporkit150
Registered User
Posts: 37
Joined: Sun Jan 12, 2003 10:55 pm

Post by sporkit150 » Thu Jul 07, 2005 5:44 pm

i converted my database some time ago with my own scripts. basically i dump the 40 char punbb encryption into the 32 char phpbb db. all my function does is sees if a trunckated pass matches the old encryption and then updates the database.

find...

Code: Select all

$username = isset($HTTP_POST_VARS['username']) ? phpbb_clean_username($HTTP_POST_VARS['username']) : '';
		$password = isset($HTTP_POST_VARS['password']) ? $HTTP_POST_VARS['password'] : '';
under paste...

Code: Select all

//*** start punnbb to phpbb password converter ***
//this extra bit of code checks if the pass is from punnbb then
//updates the password to something phpbb would understand.  there
//are other ways to do this but i believe that this requires the least
//amount of editing (and understanding) of phpbbs original code. ;')

	$sql = "SELECT user_id, username, user_password	FROM " . USERS_TABLE . " WHERE username = '" . str_replace("\\'", "''", $username) . "'";
	if ( !($result = $db->sql_query($sql)) ) { message_die(GENERAL_ERROR, 'Error in obtaining userdata', '', __LINE__, __FILE__, $sql); }
	
	//lets just make sure the user exists
	if ( mysql_num_rows( $result ) == 1 )
	{
		//users exists so lets grab their info
		if( $row = $db->sql_fetchrow($result) )
		{
			//if a sha1 encryption is equal to the pass in the database then its left over from punbb
			//also its only 32 chars long since they were trunkated in the dump
			if ( substr( sha1( $HTTP_POST_VARS['password'] ), 0, 32) == substr( $row['user_password'], 0, 32) )
			{
				//take the subbed pass and put a md5 encryption on it and insert it into the database
				$sql = "UPDATE phpbb_users SET user_password = '" . md5( $HTTP_POST_VARS['password'] ) . "' WHERE user_id = '" . $row['user_id'] . "'";
				if (@mysql_query($sql)) { /*the pass was updated to md5!!!*/ }
				else { echo("Password Error: " . mysql_error() . "<br>Please contact your board admin immediatly."); }
			}
		}
	}

//were updating the database password (if neccessary) before phpbb has a
//chance to check it.  the rest of the code should just run as if normally.
//coded by: sporkit @ www.sporkit.com © 2005
//*** end punnbb to phpbb password converter ***

User avatar
D¡cky
Former Team Member
Posts: 11812
Joined: Tue Jan 25, 2005 8:38 pm
Location: New Hampshire, USA
Name: Richard Foote
Contact:

Post by D¡cky » Fri Jul 08, 2005 3:26 am

Thank you, sporkit150 for the code. I will be including it in the next update of the convertor, with proper credits of course.

I did make a couple of modifications to it to, hopefully, make it DBAL compliant.

Code: Select all

#
#-----[ OPEN ]------------------------------------------
#
login.php
#
#-----[ FIND ]------------------------------------------
#
$username = isset($HTTP_POST_VARS['username']) ? phpbb_clean_username($HTTP_POST_VARS['username']) : '';
      $password = isset($HTTP_POST_VARS['password']) ? $HTTP_POST_VARS['password'] : '';
#
#-----[ AFTER,ADD ]------------------------------------------
#
//*** start punnbb to phpbb password converter ***
//this extra bit of code checks if the pass is from punbb then
//updates the password to something phpbb would understand.  There
//are other ways to do this but i believe that this requires the least
//amount of editing (and understanding) of phpbbs original code. ;')

   $sql = "SELECT user_id, username, user_password   FROM " . USERS_TABLE . " WHERE username = '" . str_replace("\\'", "''", $username) . "'";
   if ( !($result = $db->sql_query($sql)) ) { message_die(GENERAL_ERROR, 'Error in obtaining userdata', '', __LINE__, __FILE__, $sql); }
   
   //lets just make sure the user exists
   $count = $db->sql_numrows($result);
   if ( $count == 1 )
   {
      //users exists so lets grab their info
      if( $row = $db->sql_fetchrow($result) )
      {
         //if a sha1 encryption is equal to the pass in the database then its left over from punbb
         //also its only 32 chars long since they were truncated in the dump
         if ( substr( sha1( $HTTP_POST_VARS['password'] ), 0, 32) == substr( $row['user_password'], 0, 32) )
         {
            //take the subbed pass and put a md5 encryption on it and insert it into the database
            $sql = "UPDATE phpbb_users SET user_password = '" . md5( $HTTP_POST_VARS['password'] ) . "' WHERE user_id = '" . $row['user_id'] . "'";
			if ( !($result = $db->sql_query($sql)) )
			{
				message_die(GENERAL_ERROR, 'Password Error:<br />Please contact your board administrator immediately.', '', __LINE__, __FILE__, $sql);
			}
         }
      }
   }

//we are updating the database password (if neccessary) before phpbb has a
//chance to check it.  the rest of the code should just run as if normally.
//coded by: sporkit @ www.sporkit.com © 2005
//*** end punnbb to phpbb password converter ***
#
#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------
#
# EoM 
Have you hugged someone today?

User avatar
sporkit150
Registered User
Posts: 37
Joined: Sun Jan 12, 2003 10:55 pm

Post by sporkit150 » Fri Jul 08, 2005 8:11 am

cool, i hope it helps out. :)

also, i wish i would have known this soon but i came across the set_time_limit() function in php. if a users scirpt is timing out they could set it to 0 which would let the page run as long as it needs to.

i had a fairly large database and i think it took somewhere between 5 to 10 minutes to complete.

Tuure
Registered User
Posts: 2
Joined: Fri Jul 08, 2005 9:36 pm

Post by Tuure » Fri Jul 08, 2005 9:41 pm

First off, thanks for this converter. It really made my day! :)

But, there's one little problem... When I select a forum, it says no topics. (Which isn't true, they're in the DB, but won't show in the forum view.) On the other hand, if you go directly to the topic view, by following the 'Last post' icon, for example, the topics show just fine. Go to http://tuure.kahavi.org/phpBB2/ and see for yourself. (The language is Finnish, if you're wondering. ;) )

Summa summarum: The forum view doesn't display the topics. Otherwise the forums are fully functional.

Can someone help me out and tell me how I can fix this problem?

I converted from punBB 1.1.5 using PunBB 1.1.x convertor Version 1.

User avatar
D¡cky
Former Team Member
Posts: 11812
Joined: Tue Jan 25, 2005 8:38 pm
Location: New Hampshire, USA
Name: Richard Foote
Contact:

Post by D¡cky » Sat Jul 09, 2005 12:46 am

I just ran a test convert on PunBB 1.1.5 and it worked for me. I did notice a problem with the topic poster id, but it didn't prevent me from seeing the topics in forum view.

Check your tables and see if you can find something wrong. Look at the phpBB topics table for topic_poster, topic_first_post_id and topic_last_post_id and at the phpbb_posts table for topic_id, forum_id and poster_id.
Have you hugged someone today?

Locked

Return to “[2.0.x] Convertors”

Who is online

Users browsing this forum: No registered users and 5 guests

cron