From 17bfd27d3aab9bec71216f898f83dcf037f81bd3 Mon Sep 17 00:00:00 2001 From: pezcurrel Date: Sat, 31 Oct 2020 07:33:40 +0100 Subject: [PATCH] ... --- web/clitools/unatantum/UPDATE.php | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) diff --git a/web/clitools/unatantum/UPDATE.php b/web/clitools/unatantum/UPDATE.php index 7d1225e..05d97db 100644 --- a/web/clitools/unatantum/UPDATE.php +++ b/web/clitools/unatantum/UPDATE.php @@ -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);