ping: Fixed SQL UPDATE request

master
Felix Stupp 6 years ago
parent 0bc78841bf
commit 810803c7b2
Signed by: zocker
GPG Key ID: 93E1BD26F6B02FB7

@ -33,7 +33,7 @@ router.get("/:fqdn", (req, res) => {
router.get("/:fqdn/:code", (req, res) => { router.get("/:fqdn/:code", (req, res) => {
let addr = ipaddr.parse(req.ip); let addr = ipaddr.parse(req.ip);
if (!["ipv4", "ipv6"].includes(addr.kind())) return res.status(400).send("Invalid ip address"); if (!["ipv4", "ipv6"].includes(addr.kind())) return res.status(400).send("Invalid ip address");
db.query("UDPATE addresses SET " + addr.kind() + " = ? WHERE fqdn = ? AND code = ?", [addr.toString(), req.params.fqdn, req.params.code], (e, d) => { db.query("UPDATE addresses SET " + addr.kind() + " = ? WHERE fqdn = ? AND code = ?", [addr.toString(), req.params.fqdn, req.params.code], (e, d) => {
if (e) return res.status(400).send("Error"); if (e) return res.status(400).send("Error");
res.send(d); res.send(d);
}); });

Loading…
Cancel
Save