1
0
mirror of https://github.com/PurpleI2P/regi2p.git synced 2025-03-13 08:11:04 +00:00

fix LIKE statements in SQL query

This commit is contained in:
R4SAS 2022-08-28 19:43:52 +00:00
parent 7094ee6b2a
commit eb94626b2e

View File

@ -201,7 +201,7 @@ if (isset($_POST["record"]) && !empty($_POST["record"])) {
/* print all records, which will be deleted*/
$STH = $pdo->prepare('SELECT `host`, `base32`, `base64` FROM `hosts` WHERE `host` = ? OR `host` LIKE ?');
$STH->execute(['%'.$domain, '%'.$domain]);
$STH->execute([$domain, '%'.$domain]);
$hosts = $STH->fetchAll(PDO::FETCH_ASSOC);
foreach ($hosts as $host) {
$log .= "Host: " . $host['host'] . PHP_EOL . "Base32: " . $host['base32'] . PHP_EOL . "Base64: " . $host['base64'] . PHP_EOL;
@ -210,7 +210,7 @@ if (isset($_POST["record"]) && !empty($_POST["record"])) {
file_put_contents(__DIR__ . '/../logs/reg.log', $log, FILE_APPEND);
/* remove domain and subdomains if any found */
$pdo->prepare('DELETE FROM `hosts` WHERE `host` = ? OR `host` LIKE %?')->execute(['%'.$domain, '%'.$domain]);
$pdo->prepare('DELETE FROM `hosts` WHERE `host` = ? OR `host` LIKE ?')->execute([$domain, '%'.$domain]);
$result["reregister"] = true;
}