$uid = validate_login($errors, $_POST);
if ($uid) {
esc('Login successful!.');
- $_SESSION['user'] = $uid;
+ $_SESSION['user'] = $uid;?>
+ <p>Click <a <?php href('members.php');?>>here</a> to view the membership list.</p><?php
return;
}
$params['email_address'] = $_POST['email_address'];
require_once('includes/database.php');
require_once('includes/auth.php');
-function pre_html() {
- session_start();
-}
+session_start();
function page_title() {
return 'Members list';
tried to submit the membership form more than once (with the same email
address), only the latest submitted information is shown.</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
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');
+
+ header('Content-Type: text/csv');
+ header('Content-Disposition: inline; filename="ycra-member-emails.csv"');
+
+ while ($member = mysqli_fetch_array($result, MYSQLI_ASSOC))
+ esc($member['email_address'] . ',');
+
+ exit;
+}
+
require_once('includes/template.php');
?>