Portions created by the Initial Developer are Copyright (C) 2008-2012 the Initial Developer. All Rights Reserved. Contributor(s): Mark J Crane */ include "root.php"; require_once "resources/require.php"; require_once "resources/check_auth.php"; if (permission_exists('xml_cdr_view')) { //access granted } else { echo "access denied"; exit; } //additional includes $rows_per_page = 0; require_once "xml_cdr_inc.php"; //set the http headers header('Content-type: application/octet-binary'); header('Content-Disposition: attachment; filename=cdr.csv'); //set the csv headers $z = 0; foreach($result[0] as $key => $val) { if ($key != "xml_cdr") { if ($z == 0) { echo '"'.$key.'"'; } else { echo ',"'.$key.'"'; } } $z++; } echo "\n"; //show the csv data $x=0; while(true) { $z = 0; foreach($result[0] as $key => $val) { if ($key != "xml_cdr") { if ($z == 0) { echo '"'.$result[$x][$key].'"'; } else { echo ',"'.$result[$x][$key].'"'; } } $z++; } echo "\n"; ++$x; if ($x > ($result_count-1)) { break; } //$row++; } ?>