<?php
include("../includes/site_config.php");
include('../session_handler.inc');
# retrieve the template
$area = 'member';

$lstFromYear=$_POST['lstFromYear'];
$lstFromMonth=$_POST['lstFromMonth'];
$lstFromDay=$_POST['lstFromDay'];
$lstToYear=$_POST['lstToYear'];
$lstToMonth=$_POST['lstToMonth'];
$lstToDay=$_POST['lstToDay'];
$fromDate=$lstFromYear."-".$lstFromMonth."-".$lstFromDay;
$toDate=$lstToYear."-".$lstToMonth."-".$lstToDay;
$query="SELECT mem_email, mem_joindate FROM members
		WHERE mem_joindate BETWEEN '$fromDate' AND '$toDate'
		ORDER BY mem_joindate ASC";
	$result=mysql_query($query,$link) or die(mysql_error());
	$qrynum=mysql_num_rows($result);
header("Content-type: application/csv");
header("Content-Disposition: attachment; filename=email_report.csv");
?>
<?php	while ($sql_array = mysql_fetch_object($result) ) {?>
<?php echo $sql_array->mem_email ?><?php echo "\r\n"?>
<?php } ?>
