Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 General Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 01-22-2002, 11:35 PM
nsglazer nsglazer is offline
 
Join Date: Jan 2002
Posts: 20
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I have a old registration database from my site that has the following info:

username
password (tiny text)
first_name
last_name
email_address

Is it possible to migrate this over to vbulletin? I don't know how comfortable I feel playing with databases myself. Are there any developers that can do this work for me? If so, please contact me off list with a quote.

Neil
Reply With Quote
  #2  
Old 01-23-2002, 07:37 AM
Admin's Avatar
Admin Admin is offline
Coder
 
Join Date: Oct 2023
Location: Server
Posts: 1
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

What's the name of your current table? And are the passwords encrypted in some how, or are they kept as plain text (i.e if your password is "blabla" it would say "blabla" in the password field)?

Oh and just so you know vBulletin doesn't have fields for first/last name, so they will need to be deleted.
Reply With Quote
  #3  
Old 01-23-2002, 12:53 PM
nsglazer nsglazer is offline
 
Join Date: Jan 2002
Posts: 20
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

This info is in a separate database (called studentpilot). The table is called "users"

The relevant fields are therefore:

username
password
email_address

The password it not encrypted.. So if a password was "car" the database shows it as "car".

I also have a field for date of birth. It's in the following format:

1976-02-29
YEAR-MONTH-DAY

Neil
Reply With Quote
  #4  
Old 01-23-2002, 01:53 PM
Scott MacVicar Scott MacVicar is offline
 
Join Date: Oct 2001
Location: Glasgow, Scotland
Posts: 1,199
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I'll do something just now, unless chen can beat me :P

whats your main vBulletin database called?
Reply With Quote
  #5  
Old 01-23-2002, 02:21 PM
Scott MacVicar Scott MacVicar is offline
 
Join Date: Oct 2001
Location: Glasgow, Scotland
Posts: 1,199
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

put this code into a text edit and save it as a php file, ie file.php
upload to your vBulletin forums directory and then go run it in your browser, it will import from this old database you've described to the new vBulletin one, I presume your using 2.2.0 or above.

PHP Code:
<?
require("./global.php");
if(empty($start)) {
  $start = 0;
}
$query = $DB_site->query("SELECT * FROM studentpilot.users LIMIT $start, 100");
while($users = $DB_site->fetch_array($query)) {
  $finished = 1;
  $DB_site->query("INSERT INTO user (username, password, email, birthday) VALUES ('".addslashes(htmlspecialchars($users[username]))."','".addslashes(md5($users[password]))."','".addslashes(htmlspecialchars($users[email_address]))."', $users[dob])");
  $userid = $DB_site->insert_id();
  $DB_site->query("INSERT INTO userfield VALUES ('$userid','','','','')");
}
if($finished) {
  echo "<p><script language=\"javascript\">window.location=\"$PHP_SELF?start=".($start+100)."#end\";</script><a name=\"end\"></a><a href=\"$PHP_SELF?start=".($start+100)."#end\"><b>Continue with next</b></a></p>\n";
}
else {
  echo "<p>Import complete</p>";
}
?>
Reply With Quote
  #6  
Old 01-23-2002, 02:44 PM
nsglazer nsglazer is offline
 
Join Date: Jan 2002
Posts: 20
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks for the help.. That was quick... I had to make a slight change to the file (since I had other fields in the database). I changed it to:

<?
require("./global.php");
if(empty($start)) {
$start = 0;
}
$query = $DB_site->query("SELECT username, password, email_address, dob FROM studentpilot.users LIMIT $start, 100");
while($users = $DB_site->fetch_array($query)) {
$finished = 1;
$DB_site->query("INSERT INTO user (username, password, email, birthday) VALUES ('".addslashes(htmlspecialchars($username))."','". addslashes(md5($password))."','".addslashes(htmlsp ecialchars($email))."', $users[birthday])");
$userid = $DB_site->insert_id();
$DB_site->query("INSERT INTO userfield VALUES ($userid)");
}
if($finished) {
echo "<p><script language=\"javascript\">window.location=\"$PHP_SEL F?start=".($start+100)."#end\";</script><a name=\"end\"></a><a href=\"$PHP_SELF?start=".($start+100)."#end\"><b>C ontinue with next</b></a></p>\n";
}
else {
echo "<p>Import complete</p>";
}
?>

Anyway, I get the following error:

Database error in vBulletin 2.2.1:

Invalid SQL: INSERT INTO user (username, password, email, birthday) VALUES ('','d41d8cd98f00b204e9800998ecf8427e','', )
mysql error:

mysql error number: 0

Date: Wednesday 23rd of January 2002 11:46:22 AM
Script: http://www.studentpilot.com/interact...forum/file.php
Referer:
Reply With Quote
  #7  
Old 01-23-2002, 02:55 PM
nsglazer nsglazer is offline
 
Join Date: Jan 2002
Posts: 20
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

By the way -- there are currently 25 subscribed members in the new vbulletin forum. Would this impact the migration in any way?
Reply With Quote
  #8  
Old 01-23-2002, 03:13 PM
Scott MacVicar Scott MacVicar is offline
 
Join Date: Oct 2001
Location: Glasgow, Scotland
Posts: 1,199
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I've adjusted the code at the top could you put that all info file.php again and re-upload.

It will have no effect on new users.
Reply With Quote
  #9  
Old 01-23-2002, 03:18 PM
nsglazer nsglazer is offline
 
Join Date: Jan 2002
Posts: 20
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Now I get this error:

Database error in vBulletin 2.2.1:

Invalid SQL: INSERT INTO userfield VALUES (26)
mysql error:

mysql error number: 0

Date: Wednesday 23rd of January 2002 12:18:55 PM
Script: http://www.studentpilot.com/interact...forum/file.php
Referer:


FYI: There were 25 entries before this one... It made a 26th entry in the database that looks correct to me.
Reply With Quote
  #10  
Old 01-23-2002, 03:21 PM
Sparkz's Avatar
Sparkz Sparkz is offline
 
Join Date: Nov 2001
Posts: 544
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally posted by nsglazer
By the way -- there are currently 25 subscribed members in the new vbulletin forum. Would this impact the migration in any way?
It shouldn't affect the migration, as each new user is assigned a new and unique userid.

Looking at your code, I think it should be changed to this (not tested):

PHP Code:
<?php 
require("./global.php"); 
if(empty(
$start)) { 
$start 0

$query $DB_site->query("SELECT username, password, email_address, dob FROM studentpilot.users LIMIT $start, 100"); 
while(
$users $DB_site->fetch_array($query)) { 
$finished 1
$DB_site->query("INSERT INTO user (username, password, email, birthday) VALUES ('".addslashes(htmlspecialchars($users[username]))."','".addslashes(md5($users[password]))."','".addslashes(htmlspecialchars($users[email_address]))."', $users[dob])"); 
$userid $DB_site->insert_id(); 
$DB_site->query("INSERT INTO userfield VALUES ($userid)"); 

if(
$finished) { 
echo 
"<p><script language=\"javascript\">window.location=\"$PHP_SELF?start=".($start+100)."#end\";</script><a name=\"end\"></a><a href=\"$PHP_SELF?start=".($start+100)."#end\"><b>Continue with next</b></a></p>\n"

else { 
echo 
"<p>Import complete</p>"

?>
I guess someone was a bit to fast on the trigger while trying to get ahead of Chen to the solution

EDIT: But then again, a certain someone fixed his bugs faster than me
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 04:52 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.04365 seconds
  • Memory Usage 2,269KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (2)bbcode_php
  • (1)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (10)postbit
  • (10)postbit_onlinestatus
  • (10)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete