1
0
mirror of https://github.com/PurpleI2P/regi2p.git synced 2025-02-06 06:44:14 +00:00

fix unbuffered query execution

This commit is contained in:
R4SAS 2022-08-28 20:25:59 +00:00
parent ac9603cc43
commit 28aadecc6c

View File

@ -90,7 +90,8 @@ if (isset($_POST["record"]) && !empty($_POST["record"])) {
} else {
$base32 = $util->b32from64($parsed["b64"]);
if (!$pdo->prepare('INSERT INTO `hosts` (`host`, `base64`, `base32`) VALUES (?, ?, ?)')->execute([$domain, $parsed["b64"], $base32])) {
$STH = !$pdo->prepare('INSERT INTO `hosts` (`host`, `base64`, `base32`) VALUES (?, ?, ?)');
if (!$STH->execute([$domain, $parsed["b64"], $base32])) {
$result["error"] = "Error happened while inserting record to database. Please try again later.";
} else {
@ -119,7 +120,8 @@ if (isset($_POST["record"]) && !empty($_POST["record"])) {
} else {
$base32 = $util->b32from64($parsed["b64"]);
if (!$pdo->prepare('UPDATE `hosts` SET `base64` = ?, `base32` = ? WHERE `host` = ?')->execute([$parsed["b64"], $base32, $domain])) {
$STH = $pdo->prepare('UPDATE `hosts` SET `base64` = ?, `base32` = ? WHERE `host` = ?');
if (!$STH->execute([$parsed["b64"], $base32, $domain])) {
$result["error"] = "Error happened while updating record in database. Please try again later.";
} else {
@ -158,7 +160,8 @@ if (isset($_POST["record"]) && !empty($_POST["record"])) {
} else {
$base32 = $util->b32from64($parsed["b64"]);
if (!$pdo->prepare('INSERT INTO `hosts` (`host`, `base64`, `base32`) VALUES (?, ?, ?)')->execute([$domain, $parsed["b64"], $base32])) {
$STH = $pdo->prepare('INSERT INTO `hosts` (`host`, `base64`, `base32`) VALUES (?, ?, ?)');
if (!$STH->execute([$domain, $parsed["b64"], $base32])) {
$result["error"] = "Error happened while updating record in database. Please try again later.";
} else {
@ -223,7 +226,8 @@ if (isset($_POST["record"]) && !empty($_POST["record"])) {
$base32 = $util->b32from64($parsed["b64"]);
/* Adding to database 2LD domain */
if (!$pdo->prepare('INSERT INTO `hosts` (`host`, `base64`, `base32`) VALUES (?, ?, ?)')->execute([$domain, $parsed["b64"], $base32])) {
$STH = $pdo->prepare('INSERT INTO `hosts` (`host`, `base64`, `base32`) VALUES (?, ?, ?)');
if (!$STH->execute([$domain, $parsed["b64"], $base32])) {
$result["error"] = "Error happened while inserting record to database. Please try again later.";
} else {