芝麻web文件管理V1.00
编辑当前文件:/home/pulsehostuk9/public_html/teafund.pulsehost.co.uk/public/index.php
query("SELECT id, name FROM funds ORDER BY name")->fetchAll(PDO::FETCH_ASSOC); $fund_id = 0; if (isset($_GET['fund_id'])) { $fund_id = (int)$_GET['fund_id']; @setcookie('public_last_fund_id', (string)$fund_id, [ 'expires' => time()+31536000,'path'=>'/', 'secure' => (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off'), 'httponly' => false,'samesite'=>'Lax', ]); } elseif (!empty($_COOKIE['public_last_fund_id'])) { $fund_id = (int)$_COOKIE['public_last_fund_id']; } else { $fund_id = $funds ? (int)$funds[0]['id'] : 0; } $fund_ids = array_column($funds, 'id'); if (!in_array($fund_id, $fund_ids, true)) { $fund_id = $funds ? (int)$funds[0]['id'] : 0; @setcookie('public_last_fund_id', (string)$fund_id, [ 'expires' => time()+31536000,'path'=>'/', 'secure' => (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off'), 'httponly' => false,'samesite'=>'Lax', ]); } $year = isset($_GET['year']) ? (int)$_GET['year'] : (int)date('Y'); $months = [1=>'Jan',2=>'Feb',3=>'Mar',4=>'Apr',5=>'May',6=>'Jun',7=>'Jul',8=>'Aug',9=>'Sep',10=>'Oct',11=>'Nov',12=>'Dec']; $current_month = ((int)date('Y') === $year) ? (int)date('n') : 0; $members_stmt = $pdo->prepare("SELECT id, name FROM members WHERE fund_id = :fund AND active = 1 ORDER BY name"); $members_stmt->execute([':fund' => $fund_id]); $members = $members_stmt->fetchAll(PDO::FETCH_ASSOC); ?>
Tea Fund
>
View
query("SELECT 1 FROM information_schema.columns WHERE table_schema = DATABASE() AND table_name='payments' AND column_name='fund_id'"); $PAYMENTS_HAS_FUND = (bool)$q->fetchColumn(); } catch (Throwable $e) { $PAYMENTS_HAS_FUND = false; } $pay_map = []; if ($members) { if ($PAYMENTS_HAS_FUND) { $ps = $pdo->prepare("SELECT member_id, month, status FROM payments WHERE year = ? AND fund_id = ?"); $ps->execute([$year, $fund_id]); } else { $ids = array_column($members, 'id'); if ($ids) { $placeholders = implode(',', array_fill(0, count($ids), '?')); $sql = "SELECT member_id, month, status FROM payments WHERE year = ? AND member_id IN ($placeholders)"; $ps = $pdo->prepare($sql); $ps->execute(array_merge([$year], $ids)); } else { $ps = false; } } if ($ps) foreach ($ps->fetchAll(PDO::FETCH_ASSOC) as $p) { $pay_map[(int)$p['member_id']][(int)$p['month']] = $p['status']; } } ?>
✓ Paid
• Unpaid
⏸ Off
Current:
Member
$m): ?>
No active members in this fund.
Send low stock alert
Milk
Tea
Coffee
Sugar
Cordial
Other
Send