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:
parent
7094ee6b2a
commit
eb94626b2e
@ -201,7 +201,7 @@ if (isset($_POST["record"]) && !empty($_POST["record"])) {
|
|||||||
|
|
||||||
/* print all records, which will be deleted*/
|
/* print all records, which will be deleted*/
|
||||||
$STH = $pdo->prepare('SELECT `host`, `base32`, `base64` FROM `hosts` WHERE `host` = ? OR `host` LIKE ?');
|
$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);
|
$hosts = $STH->fetchAll(PDO::FETCH_ASSOC);
|
||||||
foreach ($hosts as $host) {
|
foreach ($hosts as $host) {
|
||||||
$log .= "Host: " . $host['host'] . PHP_EOL . "Base32: " . $host['base32'] . PHP_EOL . "Base64: " . $host['base64'] . PHP_EOL;
|
$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);
|
file_put_contents(__DIR__ . '/../logs/reg.log', $log, FILE_APPEND);
|
||||||
|
|
||||||
/* remove domain and subdomains if any found */
|
/* 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;
|
$result["reregister"] = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user