News:

Join the Facebook Fan Page.

Main Menu

phpnuke

Started by armdoggy, May 13, 2005, 05:47:44 PM

Previous topic - Next topic

Grudge

What about something like: (As a php file)

<?php
require('SSI.php');
$request db_query("SELECT user_id, user_regdata AS dateRegistered FROM phpbb_users");
while (
$row mysql_fetch_assoc($request))
  
db_query("UPDATE smf_members SET dateRegistered = " strtotime($row['dataRegistered']) . " WHERE ID_MEMBER = $row[user_id] LIMIT 1");
?>



That, or something similar, should work.
I'm only a half geek really...

Silver-SAF

I'm all confused now sorry.

Grudge

I thought you wanted to update the date registered field on your SMF members after a conversion? If so you copy and paste the contents of my code into a PHP file in your SMF directory and run it, and it should work.
I'm only a half geek really...

Chelle

Grudge:  Yeah, something like was what I was thinking...didn't have the SSI.php include in there...I'll give it a go after my backup's done and see what happens.

Silver-SAF:  I can't run convert.php again without loosing all the posts made since my board was converted, so I'm looking for a method to convert my date registered without affecting the rest of my board...that's what the code Grudge offered up is supposed to help with..does that help your confusion?
Disclaimer: The above post may contain elements of cheekiness.

My eccentricity has nothing to do with my stabilization

Chelle

#64
I get this when trying to run that php file:


Warning: Missing argument 2 for db_query() in /home/donnie6/public_html/dymb/Sources/Subs.php on line 234

Warning: Missing argument 3 for db_query() in /home/donnie6/public_html/dymb/Sources/Subs.php on line 234

Then further:

Database Error
No Database Selected
File:
Line:

The contents of that file are:  <?php
require('SSI.php');
$request db_query("SELECT user_id, user_regdate AS dateRegistered FROM chronicle_users");
while (
$row mysql_fetch_assoc($request))
  
db_query("UPDATE chronMB_members SET dateRegistered = " strtotime($row['user_regdate']) . " WHERE ID_MEMBER = $row[user_id] LIMIT 1");
?>


I looked at subs.php to see what was missing.  And I'm clueless about this string __FILE__, int __LINE__ it's expecting to try and fix something.  What are these?

BTW, I get the same thing with running the code you  offered Grudge, changing the prefixes to match what's in my database..
Disclaimer: The above post may contain elements of cheekiness.

My eccentricity has nothing to do with my stabilization

Grudge

Apologies, I forgot you need to use:

<?php
require('SSI.php');
$request db_query("SELECT user_id, user_regdate AS dateRegistered FROM chronicle_users"__FILE____LINE__);
while (
$row mysql_fetch_assoc($request))
  
db_query("UPDATE {$db_prefix}members SET dateRegistered = " strtotime($row['user_regdate']) . " WHERE ID_MEMBER = $row[user_id] LIMIT 1"__FILE____LINE__);
?>



I think the actual error may be involve specifying the phpBB database better. I've added {$db_prefix} into the SMF bit - if that doesn't stop the error you may need to edit the "chronicle_users" bit to explicitly say the phpBB database name (i.e. phpBBdatabase.chronicle_users)
I'm only a half geek really...

Chelle

No worries.  I appreciate the help and you lot  learnin  me :D

Alright, here's what's up so far:

The code will change the date reg field in the smf_members table.  So no one's no longer registered in 1969 -chuckles- but it changes the date to the day's date you run the php file.  In my case, I named it convertDate.php.  It's contents are:

<?php
require('SSI.php');
$request db_query("SELECT user_id, user_regdate AS dateRegistered FROM phpBBdatabase.prefix_users"__FILE____LINE__);
while (
$row mysql_fetch_assoc($request))
  
db_query("UPDATE {$db_prefix}members SET dateRegistered = " strtotime($row['user_regdate']) . " WHERE ID_MEMBER = $row[user_id] LIMIT 1"__FILE____LINE__);
?>


So yeah, you need to specify the db name as you thought Grudge.  I'm perplexed.  I checked all the field names, just in case and to rule that out [they're correct]  but it doesn't look like it's even looking at the data in the nuke user table.
Disclaimer: The above post may contain elements of cheekiness.

My eccentricity has nothing to do with my stabilization

Grudge

What does this reveal:
<?php
require('SSI.php');
$request = db_query("SELECT user_id, user_regdate AS dateRegistered FROM phpBBdatabase.prefix_users", __FILE__, __LINE__);
while ($row = mysql_fetch_assoc($request))
{
echo "<br />User Number $row[user_id], original date: $row[user_regdate], new date: " . strtotime($row['user_regdate']);
  db_query("UPDATE {$db_prefix}members SET dateRegistered = " . strtotime($row['user_regdate']) . " WHERE ID_MEMBER = $row[user_id] LIMIT 1", __FILE__, __LINE__);
}
?>
I'm only a half geek really...

Chelle

Here's a snippet, but you get the idea:

QuoteUser Number 1, original date: , new date: 1125039600
User Number 3, original date: , new date: 1125039600
User Number 5, original date: , new date: 1125039600
User Number 6, original date: , new date: 1125039600
User Number 7, original date: , new date: 1125039600
User Number 8, original date: , new date: 1125039600
User Number 9, original date: , new date: 1125039600
User Number 10, original date: , new date: 1125039600
User Number 11, original date: , new date: 1125039600
User Number 12, original date: , new date: 1125039600
User Number 13, original date: , new date: 1125039600
User Number 14, original date: , new date: 1125039600
User Number 15, original date: , new date: 1125039600
User Number 16, original date: , new date: 1125039600
User Number 17, original date: , new date: 1125039600
User Number 18, original date: , new date: 1125039600
User Number 19, original date: , new date: 1125039600
User Number 20, original date: , new date: 1125039600
User Number 22, original date: , new date: 1125039600

That's interesting..I checked the first query, just to make sure I got the right info in there for db name and table.  It's correct, it pulls the user_id and user_regdate just fine.  Question, I just thought of this...though I don't know why it would affect anything-  the nuke user table automatically inserts a user when you install [whose id =1 btw], it's not brought over to the SMF conversion [which is perfectly fine]...that shouldn't screw anything up, should it?
Disclaimer: The above post may contain elements of cheekiness.

My eccentricity has nothing to do with my stabilization

Grudge

Got it, stupid typo:

<?php
require('SSI.php');
$request db_query("SELECT user_id, user_regdate AS dateRegistered FROM phpBBdatabase.prefix_users"__FILE____LINE__);
while (
$row mysql_fetch_assoc($request))
  
db_query("UPDATE {$db_prefix}members SET dateRegistered = " strtotime($row['dateRegistered']) . " WHERE ID_MEMBER = $row[user_id] LIMIT 1"__FILE____LINE__);
?>

I'm only a half geek really...

Chelle

That did it!  w00t!  Thanks for all your help with this.  VERY MUCHLY Appreciated. -insert dancing smiliey here-
Disclaimer: The above post may contain elements of cheekiness.

My eccentricity has nothing to do with my stabilization

Silver-SAF

[Unknown] that is what I was trying to do, but I wasn't following along very well, sorry.

Plus, I didnt know you had to save that as a PHP file.  Will do all that now and let you know.

Soulmaster

problem :(

Converting previous poll votes... Unsuccessful!
This query:

    INSERT INTO `onweeronline`.smf_log_polls
    (ID_POLL, ID_MEMBER)
    VALUES ('1', '6'),

Caused the error:

    Duplicate entry '9-1489-0' for key 1
check out my lightning site

Soulmaster

#73
]oeps other probs :)

got 2100 members see them in the membes but not in the statistics :(


fixed :D
check out my lightning site

Soulmaster

Quote from: Grudge on August 26, 2005, 10:03:59 AM
Got it, stupid typo:

<?php
require('SSI.php');
$request db_query("SELECT user_id, user_regdate AS dateRegistered FROM phpBBdatabase.prefix_users"__FILE____LINE__);
while (
$row mysql_fetch_assoc($request))
  
db_query("UPDATE {$db_prefix}members SET dateRegistered = " strtotime($row['dateRegistered']) . " WHERE ID_MEMBER = $row[user_id] LIMIT 1"__FILE____LINE__);
?>



* Soulmaster stupid :(  but i realy don't know how to do this :(   

do i have to do this in the convert script ???
check out my lightning site

Chelle

Soulmaster, if you downloaded the .sql file a fews posts back attached by [Unknown] you should be good to go.  The other .php code Grudge posted was for people that had run the convert.php already and had their board active after they converted [meaning new posts, setting changes and new users, etc].  If you run the convert.php script AFTER your SMF boards been running and had new activity since the conversion, you'll lose everything new after you converted.


I wanted to prevent that, so I was seeking help with some code that would just focus on the date registered.


Soo, winded way of saying if you downloaded the latest convert.php and the .sql file [Unknown] attached a few posts back, you shouldn't have to worry about that bit of code.


But for anyone else wondering, that bit you would need to save as a .php file, upload it to the directory SMF is located in and run it:

http://www.yourdomain/smf_directory_name/name_of_file.php
Disclaimer: The above post may contain elements of cheekiness.

My eccentricity has nothing to do with my stabilization

stenis

Okay, after a long search for a tool like this I've finally found it! However, there is one small problem, it doesn't import hte topics. can anyone give me a hint where I should look in the PHPNuke/phpBB2-database to correct this?

Converting...
Converting ranks... successful.
Converting groups... successful.
Converting members... successful.
Converting additional member groups... successful.
Converting categories... successful.
Converting boards... successful.
Converting topics... Unsuccessful!

This query:
ALTER TABLE `database_smf`.smf_topics
ADD UNIQUE firstMessage (ID_FIRST_MSG, ID_BOARD),
ADD UNIQUE lastMessage (ID_LAST_MSG, ID_BOARD);
Caused the error:

Duplicate entry '290-16' for key 3

Thanks in advance! :)

Andreas

Compuart

This error is caused by a corrupted (phpbb) topics table. The message ID '290' appears to be the first or last message of two topics. The easiest to get around this problem is to remove (phpbb2_to_smf.php):
// Put the index's back into the table.
mysql_query("
ALTER TABLE {$to_prefix}topics
ADD UNIQUE firstMessage (ID_FIRST_MSG, ID_BOARD),
ADD UNIQUE lastMessage (ID_LAST_MSG, ID_BOARD)");


run the conversion, use SMF's repair feature ('admin' -> 'Forum Maintenance' -> 'Find and repair any errors.') and after that run the query you removed from the converter:

      ALTER TABLE smf_topics
      ADD UNIQUE firstMessage (ID_FIRST_MSG, ID_BOARD),
      ADD UNIQUE lastMessage (ID_LAST_MSG, ID_BOARD)
Hendrik Jan Visser
Former Lead Developer & Co-founder www.simplemachines.org
Personal Signature:
Realitynet.nl -> ExpeditieRobinson.net / PekingExpress.org / WieIsDeMol.Com

stenis

Quote from: Compuart on October 12, 2005, 01:55:07 PM
This error is caused by a corrupted (phpbb) topics table. The message ID '290' appears to be the first or last message of two topics. The easiest to get around this problem is to remove (phpbb2_to_smf.php):
// Put the index's back into the table.
mysql_query("
ALTER TABLE {$to_prefix}topics
ADD UNIQUE firstMessage (ID_FIRST_MSG, ID_BOARD),
ADD UNIQUE lastMessage (ID_LAST_MSG, ID_BOARD)");


run the conversion, use SMF's repair feature ('admin' -> 'Forum Maintenance' -> 'Find and repair any errors.') and after that run the query you removed from the converter:

      ALTER TABLE smf_topics
      ADD UNIQUE firstMessage (ID_FIRST_MSG, ID_BOARD),
      ADD UNIQUE lastMessage (ID_LAST_MSG, ID_BOARD)


Thank you very much, it worked like a charm! :)

hackphreik

im getting this error, and i know it says something about line 9 but can someone be more specific? thank you....

Converting members... Unsuccessful!
This query:
SELECT
u.user_id AS ID_MEMBER, SUBSTRING(u.username, 1, 80) AS memberName,
SUBSTRING(u.username, 1, 255) AS realName,
SUBSTRING(u.user_password, 1, 64) AS passwd, u.user_lastvisit AS lastLogin,
u.user_regdate AS dateRegistered,
SUBSTRING(u.user_from, 1, 255) AS location,
u.user_posts AS posts, IF(u.user_level = 1, 1, hxxp:mg.id [nonactive]_GROUP) AS ID_GROUP,
u.user_new_privmsg AS instantMessages,
SUBSTRING(u.user_email AS emailAddress, 1, 255) AS emailAddress,
u.user_unread_privmsg AS unreadMessages,
SUBSTRING(u.user_msnm AS MSN, 1, 255) AS MSN,
SUBSTRING(u.user_aim AS AIM, 1, 16) AS AIM,
SUBSTRING(u.user_icq, 1, 255) AS ICQ,
SUBSTRING(u.user_yim, 1, 32) AS YIM,
SUBSTRING(u.user_website, 1, 255) AS websiteTitle,
SUBSTRING(u.user_website, 1, 255) AS websiteUrl,
u.user_allow_viewonline AS showOnline, u.user_timezone AS timeOffset,
IF(u.user_viewemail = 1, 0, 1) AS hideEmail, u.user_avatar AS avatar,
REPLACE(u.user_sig, '\n', '<br />') AS signature,
u.user_sig_bbcode_uid AS signature_uid, u.user_avatar_type,
u.user_notify_pm AS pm_email_notify, u.user_active AS is_activated,
'' AS lngfile, '' AS buddy_list, '' AS pm_ignore_list, '' AS messageLabels,
'' AS personalText, '' AS timeFormat, '' AS usertitle, '' AS memberIP,
'' AS secretQuestion, '' AS secretAnswer, '' AS validation_code,
'' AS additionalGroups, '' AS smileySet, '' AS passwordSalt,
'' AS memberIP2
FROM `hackphre_diego`.nuke_users AS u
LEFT JOIN `hackphre_diego`.nuke_bbranks AS r ON (r.rank_id = u.user_rank AND r.rank_special = 1)
LEFT JOIN `hackphre_smf`.smf_membergroups AS mg ON (BINARY mg.groupName = CONCAT('phpBB ', r.rank_title))
WHERE u.user_id != 1
GROUP BY u.user_id
LIMIT 0, 500;
Caused the error:

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'AS emailAddress, 1, 255) AS emailAddress,
u.user_unread_privmsg AS unreadMessag' at line 9



Advertisement: