From ae6745f26add6af79ef27a189b9598456fb1d988 Mon Sep 17 00:00:00 2001 From: Sei Lisa Date: Sat, 2 Sep 2017 13:52:52 +0200 Subject: [PATCH] Fix table issues - Get rid of Y2K38 problems https://xkcd.com/607/ - This also removes default value and on-update value for the timestamp, but these were being set explicitly so no harm done. - Set the text field's character set to UTF-8. - Set the link's character set to UTF-8. --- php/settings.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/php/settings.php b/php/settings.php index f0b42fd..b1d8cf8 100644 --- a/php/settings.php +++ b/php/settings.php @@ -36,6 +36,8 @@ $link = mysqli_connect($dbhost, $dbuser, $dbpass, $dbname) or die("Error " . mys if (mysqli_connect_errno()) { die ("Connect failed: " . mysqli_connect_error()); } +// Set the character set for communication with the database +mysqli_set_charset($link, 'utf8'); if($_REQUEST['action']=="install" && $allow_install==true){ $sql = "DROP TABLE IF EXISTS $avpos_table;"; @@ -45,11 +47,11 @@ if($_REQUEST['action']=="install" && $allow_install==true){ `webkey` varchar(36) default NULL, `owner_uuid` varchar(36) default NULL, `owner_name` varchar(63) default NULL, - `text` TEXT default NULL, + `text` TEXT CHARSET utf8 default NULL, `keep` tinyint(1) default 0, `count` int(5) default NULL, `ip` varbinary(16) default NULL, - `timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, + `timestamp` datetime NOT NULL, PRIMARY KEY (`id`), UNIQUE (`webkey`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1;";