D
D
dmitry__k2015-05-15 18:14:04
MySQL
dmitry__k, 2015-05-15 18:14:04

How to remove all identical divs from the database using phpmyadmin?

Greetings!
Hackers stuffed 7,000 hidden blocks with different links into all posts

<div style="position:absolute;filter:alpha(opacity=0);opacity:0.001;z-index:10;display:none">.......</div>

how to delete them all at once)
In mysql, no boom-boom ... I ask for help!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
O
Optimus, 2015-05-15
Pyan @marrk2

Yes, mysql is not really needed here, php cycle select all records one by one, make the text in the variable
But make a backup. What site engine do you have?
UP Cycle (it does not apply to WP as a separate script for hosting):

// Сначала SELECT COUNT так получите $num
// Цикл на все статьи
for ($i = 0; $i < $num; $i++) {
    $res = mysqli_query($link," SELECT `text`,FROM `".$table."` WHERE id='".$i."' ") or die (mysql_errno() . ": " . mysql_error(). "\n");
    if($res)
    {
        while($row = mysqli_fetch_assoc($res))
        {$did[] = $row;}
        var_dump($did);
        $content = $did[0]['text'];
        
        //меняем
        $contents = preg_replace('/<div\sstyle=\"position(.*?)<\/div>/ism', "", $contents);
        
        //записываем обратно
        mysqli_query($link," UPDATE `".$table."` SET `text`='".$contents."' WHERE id='".$i."' ");
    }
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question