From 90d95598a1695e90dbad26011de3c2617b18641b Mon Sep 17 00:00:00 2001 From: "cn.yimian.xyz" Date: Sun, 23 Aug 2020 11:20:57 +0800 Subject: [PATCH] mail --- api/functions.php | 6 +++--- api/newItem.php | 26 +++++++++++++++++++++++++- index.html | 1 + 3 files changed, 29 insertions(+), 4 deletions(-) diff --git a/api/functions.php b/api/functions.php index d3426db..29bdf2f 100644 --- a/api/functions.php +++ b/api/functions.php @@ -760,8 +760,8 @@ function checkBalance($data, $threshold){ function setBalance($first, $last, $threshold, $tableId, $cnn){ - $itemIdFirst = hash('sha256', time().$tableId.$first); - $itemIdLast = hash('sha256', time().$tableId.$last); + $itemIdFirst = hash('sha256', ((int)(microtime(true)*1000)).$tableId.$first.rand(10000, 99999)); + $itemIdLast = hash('sha256', ((int)(microtime(true)*1000)).$tableId.$last.rand(10000, 99999)); $time = time(); db__pushData($cnn, "account", array( "id" => $itemIdFirst, @@ -799,7 +799,7 @@ function setBalance($first, $last, $threshold, $tableId, $cnn){ 感谢您使用本站服务,祝您生活愉悦! 呓喵酱(@iotcat)", "CP-ACC"); -//Sleep(10); +Sleep(10); yimian__mail($firstData['email'], 'CP-ACC消息: 您需要给'.$lastData['nickname'].$threshold."磅/元", "亲爱的".$firstData['nickname'].": 根据系统的计算,您需要给".$lastData['nickname']."(".$lastData['email'].")".$threshold."磅/元,以保持大家的公共支出相对公平。请在转账后提醒对方从网站或邮件中确认您的支出。您可以通过CP-ACC网站查看具体账目细节。如有任何疑问,请联系站长呓喵酱(i@iotcat.me)。 diff --git a/api/newItem.php b/api/newItem.php index a134f3e..1c65fd1 100644 --- a/api/newItem.php +++ b/api/newItem.php @@ -9,6 +9,16 @@ $passby = $_REQUEST['passby']; if(!isset($url) || !isset($passby)) die(); + + +/* special php program */ +set_time_limit(0); +ob_end_clean(); +header("Connection: close"); +header("Location: https://cp-acc.yimian.xyz/"); +ob_start(); + + $passby = json_decode(base64_decode($passby), true); $tableId = $passby['tableId']; @@ -31,6 +41,20 @@ db__pushData($cnn, "account", array( )); + + + +/* close connection */ +ob_end_flush(); +flush(); +if (function_exists("fastcgi_finish_request")) { + fastcgi_finish_request(); +} +sleep(2); +ignore_user_abort(true); +set_time_limit(0); + + $data = getFinalData($cnn, $tableId); $threshold = getThreshold($cnn, $tableId); @@ -44,9 +68,9 @@ while(!checkBalance($data, $threshold)){ if($data['average'] - $data['virtualTotals'][$first] > $threshold){ setBalance($first, $last, $threshold, $tableId, $cnn); } + Sleep(10); $data = getFinalData($cnn, $tableId); } -header("Location: https://cp-acc.yimian.xyz/"); diff --git a/index.html b/index.html index 1f80fce..44eb710 100644 --- a/index.html +++ b/index.html @@ -395,6 +395,7 @@ function load(){ userNotice.push(item); } }); + userNotice.reverse(); function notice(){ var s = '';