if (!check_logged_in()) {?>
<h1>Restricted access page</h1><?php
return;
- }?>
+ }
+
+ # Count number of members in database.
+ $result = run_sql('SELECT COUNT(id) FROM members');
+ $num_members = mysqli_fetch_row($result)[0];?>
<h1>YCRA Members</h1>
- <p>Below is a list of members, listed in order of newest first. If the member
- tried to submit the membership form more than once (with the same email
- address), only the latest submitted information is shown.</p>
+ <p>Below is a list of members, listed in order of newest first. We currently
+ have the details for <?php esc($num_members);?> members.</p>
<p>Click <a <?php href('members.php?csv=emails');?>>here</a> to download a CSV
file containing the email addresses of all members.</p>
- <p>Please note this is a work in progress and the membership records will be
- fully reconciled at some point.</p><?php
+ <p>Please note this is a work in progress.</p><?php
- $result = run_sql('SELECT * FROM members GROUP BY(email_address) ORDER BY id DESC');
- $members_num = 0;?>
+ $result = run_sql('SELECT * FROM members ORDER BY id DESC');?>
<table>
<tr>
<th>Address</th>
<th>PayPal?</th>
</tr><?php
- while ($member = mysqli_fetch_array($result, MYSQLI_ASSOC)) {
- $members_num++;?>
+ while ($member = mysqli_fetch_array($result, MYSQLI_ASSOC)) {?>
<tr>
<td><?php esc($member['id']);?></td>
<td><?php esc($member['first_name'] . ' ' . $member['surname']);?></td>
</tr><?php
}?>
</table><?php
-
- esc('Total number of members: ' . $members_num);
}
if (!empty($_GET['csv']) && $_GET['csv'] == 'emails' && check_logged_in()) {
- $result = run_sql('SELECT * FROM members GROUP BY(email_address) ORDER BY id DESC');
+ $result = run_sql('SELECT email_address FROM members GROUP BY(email_address) ORDER BY id DESC');
header('Content-Type: text/csv');
header('Content-Disposition: inline; filename="ycra-member-emails.csv"');