Simple Machines Community Forum

SMF Support => SMF 2.0.x Support => Topic started by: Sven Kortekaas on January 04, 2013, 09:56:10 AM

Title: SQL Query find and replace
Post by: Sven Kortekaas on January 04, 2013, 09:56:10 AM
Hello,

I got a little problem. I got a big forum and some poeple back in 2005 and later posted some pictures from this host: photos.lycos.com but that gives me malware warnings from Google Chrome. Is there a SQL query that I can run searching my whole forum for images from this host and replace them with the text: "Sorry your image have been removed due to security issues."
Title: Re: SQL Query find and replace
Post by: vbgamer45 on January 04, 2013, 09:57:09 AM
That's a little tricky. You could disable the link easily by doing sql search and replace on photos.lycos.com
Title: Re: SQL Query find and replace
Post by: Sven Kortekaas on January 04, 2013, 10:02:24 AM
Oke. In the phpMyAdmin I can easily do an search and replace?

Find: photos.lycos.com
Replace: deleted

Then this [img]photos.lycos.com/hello/directory/test.jpg[/img] will be [img]deleted/hello/directory/test.jpg[/img]
Title: Re: SQL Query find and replace
Post by: vbgamer45 on January 04, 2013, 10:06:24 AM
Here is code you can try

Please make a database backup first though just in case.


UPDATE smf_messages set body = REPLACE(body,  'photos.lycos.com', 'deleted')
Title: Re: SQL Query find and replace
Post by: Rob Lightbody on December 27, 2016, 08:19:51 AM
Quote from: vbgamer45 on January 04, 2013, 10:06:24 AM
Here is code you can try

Please make a database backup first though just in case.


UPDATE smf_messages set body = REPLACE(body,  'photos.lycos.com', 'deleted')


That's worked perfectly for me.  I've used it to change URLS from http to https (my own site itself, flickr and youtube) and to remove redundant imgshack links that don't work.