Go Back   vb.org Archive > vBulletin Modifications > Archive > vB.org Archives > General > Member Archives
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools
Replace certain phrase throughout DB?? Details »»
Replace certain phrase throughout DB??
Version: , by 007 007 is offline
Developer Last Online: Apr 2020 Show Printable Version Email this Page

Version: Unknown Rating:
Released: 02-11-2003 Last Update: Never Installs: 0
 
No support by the author.

Is it possible to replace a :smile: phrase throughout a DB with : ) (without the space obviously)????? I need to know because I imported posts from another (non VB) message board and all the emoticon "calls" are different than what I would like them to be. Is there any way I can replace all these in like 20,000 posts lol???

Also, this was a post only import, so all the usernames come up as userid=0. Are these names actually saved to any place that I could possibly individually add userid's to them?

I'm guessing the answer is no for both of these, but maybe somebody else has done this before? If anyone can offer any suffestions I'd appreciate it. THANKS! :classic:

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.

Comments
  #2  
Old 02-11-2003, 10:51 AM
Xenon's Avatar
Xenon Xenon is offline
 
Join Date: Oct 2001
Location: Bavaria
Posts: 12,878
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

first: replace hack was coded by the sisko (search for it )

second: well, you can write a small script, which get's all usernames out of the posts and creates a user entry in the database, this ist possible
Reply With Quote
  #3  
Old 02-11-2003, 11:08 AM
007's Avatar
007 007 is offline
 
Join Date: Jan 2003
Location: United States
Posts: 872
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

THANKS! I didn't think either of these were possible. As least the first one was. That was the easiest hack I have installed to date lol. Thanks for pointing that out for me.
Reply With Quote
  #4  
Old 02-11-2003, 11:20 AM
Xenon's Avatar
Xenon Xenon is offline
 
Join Date: Oct 2001
Location: Bavaria
Posts: 12,878
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default


you're welcome

the second:
create a file called createusers.php
PHP Code:
<?php
require('global.php');
$usernames=$DB_site->query("SELECT DISTINCT username FROM post WHERE userid=0");
while (
$username=$DB_site->fetch_array($usernames)) {
//does user exist?
if(!$userid=$DB_site->query_first("SELECT userid WHERE username='".addslashes($username)."'")) {
  
$DB_site->query("INSERT INTO user (userid,username,password,joindate) VALUES (NULL,'".addslashes($username)."',MD5('".addslashes($username)."'),".time().")");
  
$userid=$DB_site->insert_id();
  
$DB_site->query("INSERT INTO userfield (userid) VALUES ($userid)");

}
$DB_site->query("UPDATE post SET userid=$userid[userid] WHERE userid=0 AND username=".addslashes($username));

}
?>
copy this file into your forum dir and run it, it should create the users
Reply With Quote
  #5  
Old 02-11-2003, 11:27 AM
007's Avatar
007 007 is offline
 
Join Date: Jan 2003
Location: United States
Posts: 872
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

oohh.. !! thought you said it wasn't possible cool. looks scary, *backs up db first* i trust you man, but just in case. i'll let you know how it goes
Reply With Quote
  #6  
Old 02-11-2003, 11:34 AM
007's Avatar
007 007 is offline
 
Join Date: Jan 2003
Location: United States
Posts: 872
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Database error in vBulletin 2.2.9:

Invalid SQL: SELECT userid WHERE username='Array'
mysql error: You have an error in your SQL syntax near 'WHERE username='Array'' at line 1

mysql error number: 1064

hmmm, don't mean to bug you but what does this mean?? thanks again. seems like nothing bad happened but it wouldn't let me run that file I just made...
Reply With Quote
  #7  
Old 02-11-2003, 12:14 PM
Xenon's Avatar
Xenon Xenon is offline
 
Join Date: Oct 2001
Location: Bavaria
Posts: 12,878
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

yeah, sorry, my fault

use this:
PHP Code:
<?php
require('global.php');
$usernames=$DB_site->query("SELECT DISTINCT username FROM post WHERE userid=0");
while (
$username=$DB_site->fetch_array($usernames)) {
//does user exist?
if(!$userid=$DB_site->query_first("SELECT userid FROM user WHERE username='".addslashes($username[username])."'")) {
  
$DB_site->query("INSERT INTO user (userid,username,password,joindate) VALUES (NULL,'".addslashes($username[username])."',MD5('".addslashes($username[username])."'),".time().")");
  
$userid=$DB_site->insert_id();
  
$DB_site->query("INSERT INTO userfield (userid) VALUES ($userid)");
$userid['userid']=$userid;
}
$DB_site->query("UPDATE post SET userid=$userid[userid] WHERE userid=0 AND username=".addslashes($username[username]));

}
?>
Reply With Quote
  #8  
Old 02-11-2003, 12:46 PM
007's Avatar
007 007 is offline
 
Join Date: Jan 2003
Location: United States
Posts: 872
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Database error in vBulletin 2.2.9:

Invalid SQL: SELECT userid WHERE username='Dark Master'
mysql error: You have an error in your SQL syntax near 'WHERE username='Dark Master'' at line 1

mysql error number: 1064

any ideas? if this is going to be too much trouble please let me know. i'll understand.
Reply With Quote
  #9  
Old 02-11-2003, 01:07 PM
Xenon's Avatar
Xenon Xenon is offline
 
Join Date: Oct 2001
Location: Bavaria
Posts: 12,878
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

lol, silly me, have forgotten from which table it should take the userid ^^

i've updated my post above
Reply With Quote
  #10  
Old 02-11-2003, 07:44 PM
007's Avatar
007 007 is offline
 
Join Date: Jan 2003
Location: United States
Posts: 872
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Database error in vBulletin 2.2.9:

Invalid SQL: UPDATE post SET userid= WHERE userid=0 AND username=Dark Master
mysql error: You have an error in your SQL syntax near 'WHERE userid=0 AND username=Dark Master' at line 1

mysql error number: 1064

wahoo! lol hmmm, this looks sort of like the last one I got. any ideas?? thanks.
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 02:01 AM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.05267 seconds
  • Memory Usage 2,313KB
  • Queries Executed 23 (?)
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
  • (2)bbcode_php
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (6)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (9)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