Use REPLACE into instead of INSERT into. This allows for a domain's white/blacklist status to be toggled

Signed-off-by: Adam Warner <me@adamwarner.co.uk>
This commit is contained in:
Adam Warner
2020-05-13 22:01:58 +01:00
parent 9c6a582cb2
commit ef13e69125

View File

@@ -443,7 +443,7 @@ if ($_POST['action'] == 'get_groups') {
$domains = explode(' ', trim($_POST['domain']));
$total = count($domains);
$added = 0;
$stmt = $db->prepare('INSERT INTO domainlist (domain,type,comment) VALUES (:domain,:type,:comment)');
$stmt = $db->prepare('REPLACE INTO domainlist (domain,type,comment) VALUES (:domain,:type,:comment)');
if (!$stmt) {
throw new Exception('While preparing statement: ' . $db->lastErrorMsg());
}