3 define('AT_INCLUDE_PATH', '../../include/');
4 require(AT_INCLUDE_PATH.'vitals.inc.php');
6 $sql1 = stripslashes(urldecode($_GET['thisquery']));
7 $result1 = mysql_query($sql1,$db);
8 $today = date("Y-m-d_h-m-s");
9 $path = AT_CONTENT_DIR . 'payments_'.$today.'.csv';
11 function quote_csv($line) {
12 $line = str_replace('"','""', $line);
13 $line = str_replace(",", "", $line);
14 //$line = str_replace("\n", '\n', $line);
15 //$line = str_replace("\r", '\r', $line);
16 $line = str_replace("\x00", '\0', $line);
21 $fp = fopen($path, 'w');
23 while($row = mysql_fetch_array($result1)){
24 $this_purchase .= quote_csv($row['shopid']);
25 $this_purchase .= quote_csv($row['member_id']);
26 $this_purchase .= quote_csv($row['firstname']);
27 $this_purchase .= quote_csv($row['lastname']);
28 $this_purchase .= quote_csv($row['email']);
29 $this_purchase .= quote_csv($row['organization']);
30 $this_purchase .= quote_csv($row['address']);
31 $this_purchase .= quote_csv($row['postal']);
32 $this_purchase .= quote_csv($row['telephone']);
33 $this_purchase .= quote_csv($row['country']);
34 $this_purchase .= quote_csv($row['miraid']);
35 $this_purchase .= quote_csv($row['date']);
36 $this_purchase .= quote_csv($row['course_name']);
37 $this_purchase .= quote_csv($row['amount']);
38 $this_purchase .= quote_csv($row['comments']);
39 $this_purchase .= quote_csv($row['course_id'])."\r\n";
41 fputs($fp, $this_purchase);
44 header('Content-Type: application/x-excel');
45 header('Content-Disposition: inline; filename="payments_'.$today.'.csv"');
47 header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
48 header('Pragma: public');