From f85864b11c54949271dc7620ba134bf44c3f2eca Mon Sep 17 00:00:00 2001 From: Tom Early Date: Sat, 7 Mar 2020 07:44:23 -0700 Subject: [PATCH] REPLACE quoting for VALUES in CQnetDB::Update --- QnetDB.cpp | 12 ++++++------ example.php | 1 + 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/QnetDB.cpp b/QnetDB.cpp index 7a0858a..bc16880 100644 --- a/QnetDB.cpp +++ b/QnetDB.cpp @@ -51,17 +51,17 @@ bool CQnetDB::Update(const char *mycall, const char *sfx, const char *urcall, co { if (NULL == db) return false; - std::string sql = "REPLACE INTO LHEARD (mycall,sfx,urcall,module,gateway,lasttime) VALUES ("; + std::string sql = "REPLACE INTO LHEARD (mycall,sfx,urcall,module,gateway,lasttime) VALUES ('"; sql.append(mycall); - sql.append("\",\""); + sql.append("','"); sql.append(sfx); - sql.append("\",\""); + sql.append("','"); sql.append(urcall); - sql.append("\",\""); + sql.append("','"); sql.append(module); - sql.append("\",\""); + sql.append("','"); sql.append(gateway); - sql.append("\","); + sql.append("',"); sql.append("strftime('%s','now'));"); char *eMsg; diff --git a/example.php b/example.php index 3166ec3..d7e56d5 100644 --- a/example.php +++ b/example.php @@ -31,6 +31,7 @@ function GetCFGValue(string $key) { + global $cfg, $defaults; if (array_key_exists($key, $cfg)) return $cfg[$key]; if ('module_' == substr($key, 0, 7)) {