From 3c05b50e3d3714ff657ce232273f1e5b87ac6458 Mon Sep 17 00:00:00 2001 From: tianya Date: Thu, 4 May 2023 21:55:02 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=87=E4=BB=B6=E4=B8=8A=E4=BC=A0=E9=99=90?= =?UTF-8?q?=E5=88=B6=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/user/api.php | 18 +++++++++++++++++- src/user/templets/edit_baseinfo.htm | 2 ++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/src/user/api.php b/src/user/api.php index 1420f9b3..eeef58a9 100755 --- a/src/user/api.php +++ b/src/user/api.php @@ -139,14 +139,30 @@ if ($action === 'is_need_check_code') { CloseFtp(); } //头像特殊处理 + $fsize = filesize($ff["tmp_name"]); if ($type === "face") { $target_file = $cfg_basedir.$cfg_user_dir."/{$cfg_ml->M_ID}/newface.png"; $target_url = $cfg_mediasurl.'/userup'."/{$cfg_ml->M_ID}/newface.png"; + if ($fsize > ($cfg_max_face * 1024)) { + echo json_encode(array( + "code" => -1, + "msg" => "头像尺寸不能超过{$cfg_max_face}KB", + $rkey => null, + )); + exit; + } } else { + if ($fsize > ($cfg_mb_upload_size * 1024)) { + echo json_encode(array( + "code" => -1, + "msg" => "会员上传文件不能超过{$cfg_mb_upload_size}KB", + $rkey => null, + )); + exit; + } $nowtme = time(); $rnd = $nowtme.'-'.mt_rand(1000,9999); $target_file = $cfg_basedir.$cfg_user_dir."/{$cfg_ml->M_ID}/".$rnd.".".$exts; - $fsize = filesize($ff["tmp_name"]); $target_url = $cfg_mediasurl.'/userup'."/{$cfg_ml->M_ID}/".$rnd.".".$exts; $row = $dsql->GetOne("SELECT aid,title,url FROM `#@__uploads` WHERE url LIKE '$target_url' AND mid='".$cfg_ml->M_ID."'; "); $uptime = time(); diff --git a/src/user/templets/edit_baseinfo.htm b/src/user/templets/edit_baseinfo.htm index 64450c6a..9cc0c762 100755 --- a/src/user/templets/edit_baseinfo.htm +++ b/src/user/templets/edit_baseinfo.htm @@ -156,6 +156,8 @@ if (result.code === 0) { $("#face").attr('src', result.data); $("#newface").val(result.data); + } else { + ShowMsg(result.msg); } }, error: function (xhr, status, error) {