From b2f74bedaa80cce3e03c828bb4eb83ee01575289 Mon Sep 17 00:00:00 2001 From: lgb <353856593@qq.com> Date: Mon, 20 May 2024 11:59:12 +0800 Subject: [PATCH] takeinvite add lock --- include/constants.php | 2 +- public/takeinvite.php | 12 +++++++++--- resources/lang/en/nexus.php | 1 + resources/lang/zh_CN/nexus.php | 1 + resources/lang/zh_TW/nexus.php | 1 + 5 files changed, 13 insertions(+), 4 deletions(-) diff --git a/include/constants.php b/include/constants.php index 5c5515ca..d7bbfd10 100644 --- a/include/constants.php +++ b/include/constants.php @@ -1,6 +1,6 @@ get()) { + $errMsg = nexus_trans("nexus.do_not_repeat"); + stderr($errMsg, $errMsg); +} registration_check('invitesystem', true, false); $userRep = new \App\Repositories\UserRepository(); try { @@ -15,8 +23,6 @@ function bark($msg) { stdfoot(); exit; } - -$id = $CURUSER['id']; $email = unesc(htmlspecialchars(trim($_POST["email"]))); $email = safe_email($email); $preRegisterUsername = $_POST['pre_register_username'] ?? ''; @@ -123,7 +129,7 @@ if ($sendResult === true) { sql_query("UPDATE users SET invites = invites - 1 WHERE id = ".mysql_real_escape_string($id)) or sqlerr(__FILE__, __LINE__); } } - +$lock->release(); header("Refresh: 0; url=invite.php?id=".htmlspecialchars($id)."&sent=1"); ?> diff --git a/resources/lang/en/nexus.php b/resources/lang/en/nexus.php index c0e0748c..f9fac3a7 100644 --- a/resources/lang/en/nexus.php +++ b/resources/lang/en/nexus.php @@ -15,4 +15,5 @@ return [ 'action' => 'Action', 'no_limit' => 'No limit', 'sum' => 'Sum', + 'do_not_repeat' => 'Please do not repeat the operation!', ]; diff --git a/resources/lang/zh_CN/nexus.php b/resources/lang/zh_CN/nexus.php index e141a223..d92d4e00 100644 --- a/resources/lang/zh_CN/nexus.php +++ b/resources/lang/zh_CN/nexus.php @@ -15,4 +15,5 @@ return [ 'action' => '操作', 'no_limit' => '不限', 'sum' => '累计', + 'do_not_repeat' => '请不要重复操作!', ]; diff --git a/resources/lang/zh_TW/nexus.php b/resources/lang/zh_TW/nexus.php index a0c735aa..921268bd 100644 --- a/resources/lang/zh_TW/nexus.php +++ b/resources/lang/zh_TW/nexus.php @@ -15,4 +15,5 @@ return [ 'action' => '操作', 'no_limit' => '不限', 'sum' => '累計', + 'do_not_repeat' => '請不要重復操作!', ];