msimonds
01-13-2004, 10:00 PM
I have a script that will correct the user regdate from phpbb to vbulletin so you will not get the registration date of 1969 or 1970 for those of you that have had problems with this is the past. I had this problem going from the nuke/phpbb port ---->to a standalone phpbb----->to vbulletin anyone is interested so when you convert your forums the correct registration date will appear and place the unix date back into the table!. Please let me know what you think of this script! I have tested this at least 10 times:
MAKE A BACKUP OF YOUR phpbb_users table and data before you run this script!
<?
/************************************************** *****************/
/* Place this file in the same folder as config.php */
/************************************************** *****************/
define('IN_PHPBB', true);
$phpbb_root_path = './';
include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'common.'.$phpEx);
$sql = "SELECT user_id, user_regdate FROM phpbb_users";
$result = $db->sql_query($sql);
while($record = $db->sql_fetchrow($result)) {
extract($record);
$user_regdate = str_replace(',',' ',$user_regdate);
$date = explode(' ',$user_regdate,3);
switch($date[0]) {
case('Jan'): $m=1; break;
case('Feb'): $m=2; break;
case('Mar'): $m=3; break;
case('Apr'): $m=4; break;
case('May'): $m=5; break;
case('Jun'): $m=6; break;
case('Jul'): $m=7; break;
case('Aug'): $m=8; break;
case('Sep'): $m=9; break;
case('Oct'): $m=10; break;
case('Nov'): $m=11; break;
case('Dec'): $m=12; break;
}
$newDate = mktime(0, 0, 0, $m, $date[1], $date[2]);
echo $user_id.' -- '.$user_regdate.' = '.$newDate.' = '.date('m d Y',$newDate).'<br />';
/************************************************** *****************/
/* When you are satisfied that the code is working correctly, */
/* uncomment the following 2 lines and resubmit the script. */
/************************************************** *****************/
//$sql = "UPDATE phpbb_users set user_regdate = $newDate where user_id = $user_id";
//$result1 = $db->sql_query($sql);
}
?>
name it whatever you want. I named it correct.php
thanks
Mike
MAKE A BACKUP OF YOUR phpbb_users table and data before you run this script!
<?
/************************************************** *****************/
/* Place this file in the same folder as config.php */
/************************************************** *****************/
define('IN_PHPBB', true);
$phpbb_root_path = './';
include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'common.'.$phpEx);
$sql = "SELECT user_id, user_regdate FROM phpbb_users";
$result = $db->sql_query($sql);
while($record = $db->sql_fetchrow($result)) {
extract($record);
$user_regdate = str_replace(',',' ',$user_regdate);
$date = explode(' ',$user_regdate,3);
switch($date[0]) {
case('Jan'): $m=1; break;
case('Feb'): $m=2; break;
case('Mar'): $m=3; break;
case('Apr'): $m=4; break;
case('May'): $m=5; break;
case('Jun'): $m=6; break;
case('Jul'): $m=7; break;
case('Aug'): $m=8; break;
case('Sep'): $m=9; break;
case('Oct'): $m=10; break;
case('Nov'): $m=11; break;
case('Dec'): $m=12; break;
}
$newDate = mktime(0, 0, 0, $m, $date[1], $date[2]);
echo $user_id.' -- '.$user_regdate.' = '.$newDate.' = '.date('m d Y',$newDate).'<br />';
/************************************************** *****************/
/* When you are satisfied that the code is working correctly, */
/* uncomment the following 2 lines and resubmit the script. */
/************************************************** *****************/
//$sql = "UPDATE phpbb_users set user_regdate = $newDate where user_id = $user_id";
//$result1 = $db->sql_query($sql);
}
?>
name it whatever you want. I named it correct.php
thanks
Mike