From 77c1bc5aafe352960c774e602ef10912d3c3cb4c Mon Sep 17 00:00:00 2001 From: xiaomlove Date: Wed, 14 Dec 2022 16:39:19 +0800 Subject: [PATCH] send invite temporary only --- public/invite.php | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/public/invite.php b/public/invite.php index 5a0488ca..384b4d6b 100644 --- a/public/invite.php +++ b/public/invite.php @@ -28,7 +28,7 @@ function inviteMenu ($selected = "invitee") { end_main_frame(); } -$res = sql_query("SELECT username FROM users WHERE id = ".mysql_real_escape_string($id)) or sqlerr(); +$res = sql_query("SELECT * FROM users WHERE id = ".mysql_real_escape_string($id)) or sqlerr(); $user = mysql_fetch_assoc($res); if (!$user) { stderr($lang_invite['std_sorry'], 'Invalid id'); @@ -43,8 +43,7 @@ print("

".$user['username'].$l print("

".$msg."

"); } -$res = sql_query("SELECT invites FROM users WHERE id = ".mysql_real_escape_string($id)) or sqlerr(); -$inv = mysql_fetch_assoc($res); +$inv = $user; //for one or more. "invite"/"invites" if ($inv["invites"] != 1){ @@ -72,9 +71,12 @@ if ($type == 'new'){ ; $invitation_body = $lang_invite['text_invitation_body'].$CURUSER['username']; //$invitation_body_insite = str_replace("
","\n",$invitation_body); - $inviteSelectOptions = ''; + $inviteSelectOptions = ''; + if ($inv['invites'] > 0) { + $inviteSelectOptions = ''; + } foreach ($temporaryInvites as $tmp) { - $inviteSelectOptions .= sprintf('', $tmp->hash, $tmp->hash, $lang_invite['text_expired_at'], $tmp->expired_at); + $inviteSelectOptions .= sprintf('', $tmp->hash, $tmp->hash, $lang_invite['text_expired_at'], $tmp->expired_at); } print("
". "".