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

Reply
 
Thread Tools Display Modes
  #11  
Old 01-23-2002, 03:24 PM
Scott MacVicar Scott MacVicar is offline
 
Join Date: Oct 2001
Location: Glasgow, Scotland
Posts: 1,199
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

edited my first post again, and i tested it this time to check for errors,

it works sorry about those first errors, and the person with id 26 will be duplicated.
Reply With Quote
  #12  
Old 01-23-2002, 03:30 PM
nsglazer nsglazer is offline
 
Join Date: Jan 2002
Posts: 20
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I have one other question... How would I modify this code one last time to give a value of "2" to the usergroupid fields-- This is so I don't have to manually give everybody permission later.. I think thats the right thing that needs changing? Is there anything else in the other fields that needs to be set in advance? I want to make sure I get this right now... I am migrating 7,000+ records.

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

PHP Code:
$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])"); 
becomes

PHP Code:
$DB_site->query("INSERT INTO user (username, password, email, birthday,usergroupid) VALUES ('".addslashes(htmlspecialchars($users[username]))."','".addslashes(md5($users[password]))."','".addslashes(htmlspecialchars($users[email_address]))."', $users[dob]), '2'"); 
Reply With Quote
  #14  
Old 01-23-2002, 03:42 PM
nsglazer nsglazer is offline
 
Join Date: Jan 2002
Posts: 20
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I don't seem to be having much luck with this. Now I get the following error:

Database error in vBulletin 2.2.1:

Invalid SQL: INSERT INTO user (username, password, email, birthday,usergroupid) VALUES ('mike','efe6398127928f1b2e9ef3207fb82663','mike@n o.com', 1976-02-29), '2'
mysql error:

mysql error number: 0

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

Just to double check, this is exactly what the file looks like:

PHP Code:
<?
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,usergroupid) VALUES ('".addslashes(htmlspecialchars($users[username]))."','".addslashes(md5($users[password]))."','".addslashes(htmlspecialchars($users[email_address]))."', $users[dob]), '2'");
  $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
  #15  
Old 01-23-2002, 03:45 PM
Scott MacVicar Scott MacVicar is offline
 
Join Date: Oct 2001
Location: Glasgow, Scotland
Posts: 1,199
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I don't seem to be having a good coding day lol

try this

PHP Code:
<?
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,usergroupid) VALUES ('".addslashes(htmlspecialchars($users[username]))."','".addslashes(md5($users[password]))."','".addslashes(htmlspecialchars($users[email_address]))."', $users[dob], '2')");
  $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
  #16  
Old 01-23-2002, 03:48 PM
nsglazer nsglazer is offline
 
Join Date: Jan 2002
Posts: 20
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hmm... Well, that fixed the last problem... But now I have a new problem. Looking at the mysql database, one record is added with that code... Then it gets this message:

Database error in vBulletin 2.2.1:

Invalid SQL: INSERT INTO userfield VALUES ('31','','','','')
mysql error:

mysql error number: 0

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



By the way, thanks for all of your help with this. I really appreciate it. Without your help I would be totally lost.

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

how many custom fields have you created?
Reply With Quote
  #18  
Old 01-23-2002, 03:54 PM
nsglazer nsglazer is offline
 
Join Date: Jan 2002
Posts: 20
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

There are five Custom Profile Fields:

Title Required Hidden Editable Maxlength Size Modify
Total Time No No Yes 250 25 [edit] [remove]
Ratings No No Yes 250 25 [edit] [remove]
I Fly No No Yes 250 25 [edit] [remove]
Location No No Yes 250 25 [edit] [remove]
Occupation No No Yes 250 25 [edit] [remove

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

I checked your register page, you have 5 custom fields according to that.
Use this version then
PHP Code:
<?
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,usergroupid) VALUES ('".addslashes(htmlspecialchars($users[username]))."','".addslashes(md5($users[password]))."','".addslashes(htmlspecialchars($users[email_address]))."', $users[dob], '2')");
  $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
  #20  
Old 01-23-2002, 04:10 PM
nsglazer nsglazer is offline
 
Join Date: Jan 2002
Posts: 20
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

IT worked!!! Imported 7,024 new users :-)

You saved me a ton of time and a headache -- thanks for all the help!

NEil
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 05:06 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.04431 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
  • (5)bbcode_php
  • (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