This commit is contained in:
pezcurrel 2020-10-31 07:33:40 +01:00
parent 7da003e8df
commit 17bfd27d3a

View file

@ -16,25 +16,13 @@ $link=mysqli_connect($iniarr['db_host'],$iniarr['db_admin_name'],$iniarr['db_adm
or mexit('Impossibile connettersi al database: '.mysqli_connect_error().' ['.mysqli_connect_errno().']'.N,1);
mysqli_set_charset($link,'utf8mb4');
mysqli_query($link,"ALTER TABLE `ZStats` ADD `HitsLang` VARCHAR(5000) NOT NULL AFTER `Hits`;")
or mexit(mysqli_error($link).N,2);
mysqli_query($link,"ALTER TABLE `ZStats` ADD `HitsPage` VARCHAR(5000) NOT NULL AFTER `HitsLang`;")
or mexit(mysqli_error($link).N,2);
$res=mysqli_query($link,"SELECT * FROM `ZStats`")
or mexit(mysqli_error($link).N,2);
$hlang;
$res=mysqli_query($link,'SELECT * FROM ZStats');
$hpage;
while ($row=mysqli_fetch_assoc($res)) {
$hlang='ca:'.$row['HitsCa'].';en:'.$row['HitsEn'].';es:'.$row['HitsEs'].';fr:'.$row['HitsFr'].';it:'.$row['HitsIt'];
$hpage='home:'.$row['HitsHome'].';inst:'.$row['HitsInst'].';about:'.$row['HitsAbout'].';stats:'.$row['HitsStats'].';contrib:'.$row['HitsContrib'].';404:'.$row['Hits404'];
mysqli_query($link,"UPDATE `ZStats` SET HitsLang='".$hlang."', HitsPage='".$hpage."' WHERE TS=".$row['TS']);
$hpage=preg_replace(array('#inst#','#contrib#'),array('instances','contribute'),$row['HitsPage']);
mysqli_query($link,"UPDATE `ZStats` SET HitsPage='".$hpage."' WHERE TS=".$row['TS']);
}
mysqli_query($link,"ALTER TABLE `ZStats` DROP `HitsCa`, DROP `HitsEn`, DROP `HitsEs`, DROP `HitsFr`, DROP `HitsIt`, DROP `HitsHome`, DROP `HitsInst`, DROP `HitsAbout`, DROP `HitsStats`, DROP `HitsContrib`, DROP `Hits404`;")
or mexit(mysqli_error($link).N,2);
mysqli_close($link);
exit(0);