| Server IP : 188.114.96.3 / Your IP : 104.23.243.216 Web Server : Apache System : Linux web236.dogado.net 4.18.0-553.141.2.lve.el7h.x86_64 #1 SMP Wed Jul 8 17:20:31 UTC 2026 x86_64 User : h193310 ( 10083) PHP Version : 8.4.12 Disable Function : opcache_get_status MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /var/www/vhosts/h193310.web236.dogado.net/httpdocs/wp-content/ |
Upload File : |
<?php
/**************************************************
Convert WP Content encoding
BASISSCRIPT: Markus Tacker <m@tacker.org>
Modified: Frank Bueltge <bueltge.de>
***************************************************/
// New coding
$new_encoding = 'UTF-8';
// WordPress config
require_once '../wp-config.php';
// Connect DB
$DBC = mysql_connect(DB_HOST, DB_USER, DB_PASSWORD);
mysql_select_db(DB_NAME, $DBC);
$table = $wpdb->prefix.'comments';
echo '<pre>';
$result_data = mysql_query('SELECT * FROM ' . $table);
echo $table . ' ';
while ($data = mysql_fetch_assoc($result_data)) {
$sql = 'UPDATE ' . $table;
// Build set
$set = array();
foreach ($data as $key => $val) {
$set[] = ek($key) . '=' . ev(mb_convert_encoding($data[$key], $new_encoding));
}
$sql .= ' SET ' . join(', ', $set);
// Build where
$where = array();
foreach ($data as $key => $val) {
if (!preg_match('/[0-9]+/', $val)) continue; // Use only numbers in where
$where[] = ek($key) . '=' . ev($data[$key]);
}
$sql .= ' WHERE ' . join(' AND ', $where);
$query_result = mysql_query($sql, $DBC);
if (!$query_result) {
die('Invalid query: ' . mysql_error());
}
echo '.';
flush();
}
echo "\n";
echo 'All done.>/pre>';
// Disconnect DB
mysql_close($DBC);
function ek($string)
{
global $DBC;
return "`" . mysql_real_escape_string($string, $DBC) . "`";
}
function ev($string)
{
global $DBC;
return "'" . mysql_real_escape_string($string, $DBC) . "'";
}
?>