vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=251)
-   -   Remove ICQ/MSN/YAHOO/BIO etc. of around 1600 users via Phpmyadmin. (https://vborg.vbsupport.ru/showthread.php?t=317171)

SaN-DeeP 02-05-2015 08:33 AM

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.

kh99 02-05-2015 10:29 AM

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.

SaN-DeeP 02-05-2015 10:36 AM

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,

kh99 02-05-2015 10:42 AM

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).

SaN-DeeP 02-05-2015 10:49 AM

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.

kh99 02-05-2015 11:18 AM

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.

SaN-DeeP 02-06-2015 10:53 AM

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 ?

kh99 02-06-2015 11:13 AM

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.

SaN-DeeP 02-06-2015 11:22 AM

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.

Dave 02-06-2015 11:38 AM

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


All times are GMT. The time now is 07:12 AM.

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.01146 seconds
  • Memory Usage 1,747KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (9)bbcode_code_printable
  • (4)bbcode_html_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.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/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.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
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete