
	<?php
	/*
	Hezecom Email Solution
	Author: Hezecom Technologies (http://hezecom.com) info@hezecom.net
	COPYRIGHT 2014 ALL RIGHTS RESERVED
	
	You must have purchased a valid license from CodeCanyon.com in order to have 
	access this file.

	You may only use this file according to the respective licensing terms 
	you agreed to when purchasing this item.
	*/
	if(!defined('VALID_DIR')) die('You are not allowed to execute this file directly');
	?>
	<?php
	ob_start();
	$etype=get('etype');
	$excel='
	<p style="font-family:arial; font-size:18px;" align="left">
	<strong style="font-family:arial;">'.LANG_REPORT_TITLE.'</strong><br>'.LANG_REPORT_SUB_TITLE.'<br>
	<strong>'.LANG_REPORT_TABLE.'</strong> Mailusers</p>';
	$excel.='<table border="1" cellspacing="0" width="100%" style="font-family:arial; font-size:14px;" cellpadding="5">
	<tr>
      <th>'.LANG_FIRST_NAME.'</th>
      <th>'.LANG_LAST_NAME.'</th>
      <th>'.LANG_USER_EMAIL.'</th>
      <th>'.LANG_BITHDAY.'</th>
      <th>'.LANG_GENDER.'</th>
      <th>'.LANG_PHONE.'</th>
      <th>'.LANG_ALTERNATE_EMAIL.'</th>
      <th>'.LANG_LOCATION.'</th>
      <th>'.LANG_DATE_REGISTERED.'</th>
  </tr>
  ';
	foreach($result as $rows)
			{
	$excel.='<tr>
	<td>'.$rows->cfname.'</td>
	<td>'.$rows->clname.'</td>
	<td>'.$rows->cusername.'</td>
	<td>'.$rows->cbirthday.'</td>
	<td>'.$rows->cgender.'</td>
	<td>'.$rows->cphone.'</td>
	<td>'.$rows->cemail.'</td>
	<td>'.$rows->clocation.'</td>
	<td>'.$rows->rdate.'</td>
	</tr>';
	}
	$excel.='</table>';
	$filename1= 'mailusers_'.date('Y-m-d').'.doc';
	$filename2= 'mailusers_'.date('Y-m-d').'.xls';
	$pdf_output= 'mailusers_'.date('Y-m-d').'.pdf';
	if ($etype == 'word') {
	header("Content-type: application/msword");
	header("Content-Disposition: attachment; filename=$filename1");
	header("Pragma: no-cache");
	header("Expires: 0");
	print $excel;
	}
	elseif ($etype == 'excel') {
	header("Content-type: application/msexcel");
	header("Content-Disposition: attachment; filename=$filename2");
	header("Pragma: no-cache");
	header("Expires: 0");
	print $excel;
	}
	elseif ($etype == 'printer') {
	print'<title>'.H_TITLE.'</title>
	<script type="text/javascript">
	window.onload = function () {
		window.print();
	}
	</script>
	';
	print $excel;
	}
	elseif ($etype == 'PDF') {
	HezecomPDF($excel, $pdf_output);
	}
	ob_end_flush();
	?>