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

Reply
 
Thread Tools Display Modes
  #1  
Old 02-05-2015, 08:33 AM
SaN-DeeP's Avatar
SaN-DeeP SaN-DeeP is offline
 
Join Date: Jun 2002
Location: Mumbai, India
Posts: 1,195
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Remove ICQ/MSN/YAHOO/BIO etc. of around 1600 users via Phpmyadmin.

I was just working on a forum setup few years ago.. then took offline.
It has around 1540 users. (mostly spammers)
I dont want to delete those members. Is there anyway I can remove there ICQ/MSN/BIO/INTERESTS and other details directly via PHPMYADMIN ?

Thanks.
Reply With Quote
  #2  
Old 02-05-2015, 10:29 AM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

You should be able to do something like this:
Code:
UPDATE user SET msn='', icq=''
and of course add whatever other fields you want. Also, for the bio, location, interests, occupation:
Code:
UPDATE userfield SET field1='', field2='', field3='', field4=''
and if you have other custom profile fields you could add them to that query.

As always, you should make sure you have a database backup before modifying the database directly, just in case.

Edit: you could also add "WHERE usergroupid=X" to do it only for a certain group, if you have other users (admins and mods) that you don't want to change.
Reply With Quote
  #3  
Old 02-05-2015, 10:36 AM
SaN-DeeP's Avatar
SaN-DeeP SaN-DeeP is offline
 
Join Date: Jun 2002
Location: Mumbai, India
Posts: 1,195
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Dear kh99,
You saved me lot of time...

I want to few more advanced things if possible.

1. Change username of those users from xyz2 to abc1
Can i directly edit this from phpmyadmin ?
Opening the DB in phpmyadmin and changing the usernames for faster process.

2. Can I also change passwords of this usergroups to something UNIQUE ?
Change passwords for all users to XXYYZZ1122.
I tried to setup this password in PHPMYADMIN, but that wont help me login. (gives wrong password)

Regards,
Reply With Quote
  #4  
Old 02-05-2015, 10:42 AM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I can't think of any reason offhand that you couldn't change the username field directly, except that I think there are other tables that have a username field (like the thread last poster) that won't be changed.

You should be able to change the password, but it's hashed. I think you'd need to do something like:

Code:
UPDATE user set password=MD5(CONCAT(MD5('XXYYZZ1122'),salt))

but I haven't tested this. Be careful because as I'm sure you're aware, if it doesn't work you won't be able to log in either (unless you add a WHERE so that your password isn't changed).
Reply With Quote
  #5  
Old 02-05-2015, 10:49 AM
SaN-DeeP's Avatar
SaN-DeeP SaN-DeeP is offline
 
Join Date: Jun 2002
Location: Mumbai, India
Posts: 1,195
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Dear kh99,
Thanks again for keeping with me and your quick answers.

The database only has users NO CONTENT/NO POSTS/NO THREADS..
I dont want to delete all the users, as those were registered few years ago.. and its from a VERY UNIQUE NICHE..
But we have around 500+ banned spammers as well..
We promoted that site few years ago, then closed because of busy schedule. time to re-launch again soon.

I want to run a query.. which can change passwords for all users who belong to a specific usergroup (primary or secondary) to fasten my process.
I will manage changing the usernames manually via PHPMYADMIN which works perfect..


THANKS FOR suggesting backup.. taking a new backup everytime after successfully accomplishing above tasks in proper order.

*Hardly few MBs back* directly storing on server, naming appropriately.

Regards,

--------------- Added [DATE]1423141417[/DATE] at [TIME]1423141417[/TIME] ---------------

I tried to run the above query..
Code:
UPDATE User2 set password=MD5(CONCAT(MD5('XXYYZZ1122'),salt))
User2 = the username I am trying to change.

Getting following error:
#1146 - Table 'DBi_dbname.User2' doesn't exist

Not a techy to frame query or code.
Reply With Quote
  #6  
Old 02-05-2015, 11:18 AM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

You'd want something like this:
Code:
UPDATE user SET password=MD5(CONCAT(MD5('XXYYZZ1122'),salt)) WHERE username='User2'

If you want to do it for a primary usergroup, you'd change the WHERE part to
Code:
WHERE usergroupid=X

For a secondary usergroup, I think this will work:
Code:
WHERE FIND_IN_SET(X, membergroupids) != NULL

If you want to test before doing an actual change, you could do something like
Code:
SELECT username FROM user WHERE FIND_IN_SET(X, membergroupids) != NULL

and see what gets selected.

Of course in the above queries you want to replace X with the usergroupid you're interested in.
Reply With Quote
  #7  
Old 02-06-2015, 10:53 AM
SaN-DeeP's Avatar
SaN-DeeP SaN-DeeP is offline
 
Join Date: Jun 2002
Location: Mumbai, India
Posts: 1,195
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hello once again.
I was able to sucessfully use following command for 1 site:
HTML Code:
UPDATE user set password=MD5(CONCAT(MD5('XXYYZZ1122'),salt))
Which successfully worked for all users.. Big thanks..

************************************************** *************

But for another complex site.. which has few different user groups..
(Many Paid members here offline/online payment method, differentiated into multiple groups by mode of payment/amount etc.)

Example:
UserOne belongs to GROUP NAME Members ID = 2
UserOne is also under another GROUP NAME Paid Donors ID = 117 - This is like an Additional Group member belongs too.

Trying to run the queries you guided me with, these are results.
HTML Code:
SELECT username FROM vb3_user WHERE FIND_IN_SET(117, membergroupids) = NULL
Gives this:
Results: 0 (2.5048s), Page 1 of 0

HTML Code:
UPDATE vb3_user SET password=MD5(CONCAT(MD5('XXYYZZ1122'),salt)) WHERE FIND_IN_SET(117, membergroupids) != NULL
Gives this:
Confirm Query Execution
This query may modify data in your database. If this change is done in error, it is possible that you will not be able to recover from this change. Are you sure you wish to continue?

Affected Rows: 0 (3.3929s)

There are many users in Group ID - 117

Seems I am missing something ?
Reply With Quote
  #8  
Old 02-06-2015, 11:13 AM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Well, I have to admit that I didn't try it. I think the problem is that you have to check for 0 instead of NULL. So
Code:
SELECT username FROM vb3_user WHERE FIND_IN_SET(117, membergroupids) = 0
should give you users who are not in group 117.
Reply With Quote
  #9  
Old 02-06-2015, 11:22 AM
SaN-DeeP's Avatar
SaN-DeeP SaN-DeeP is offline
 
Join Date: Jun 2002
Location: Mumbai, India
Posts: 1,195
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Yes it worked fine.., gives all users not are not in Group ID - 117

--------------- Added [DATE]1423229058[/DATE] at [TIME]1423229058[/TIME] ---------------

and this
HTML Code:
SELECT username FROM vb3_user WHERE FIND_IN_SET(117, membergroupids) = 1
gives all user who are in group 117 properly.

--------------- Added [DATE]1423229433[/DATE] at [TIME]1423229433[/TIME] ---------------

should i try
UPDATE vb3_user SET password=MD5(CONCAT(MD5('XXYYZZ1122'),salt)) WHERE FIND_IN_SET(117, membergroupids) != 1
OR
UPDATE vb3_user SET password=MD5(CONCAT(MD5('XXYYZZ1122'),salt)) WHERE FIND_IN_SET(117, membergroupids) != 0

dont want to risk.
Reply With Quote
  #10  
Old 02-06-2015, 11:38 AM
Dave Dave is offline
 
Join Date: May 2010
Posts: 2,583
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

If you're unsure, change your query to SELECT first to see which rows will be affected.

SELECT * FROM vb3_user WHERE FIND_IN_SET(117, membergroupids) != 1
--
SELECT * FROM vb3_user WHERE FIND_IN_SET(117, membergroupids) != 0
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 06:26 PM.


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.09497 seconds
  • Memory Usage 2,272KB
  • Queries Executed 13 (?)
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
  • (9)bbcode_code
  • (4)bbcode_html
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)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
  • (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_postinfo_query
  • fetch_postinfo
  • 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