Code: Select all
<?
define('OFFERS_DONT_SHOW_NEW',1);
require "./auth.php";
global $my_xcart_url;
$myFile = "testFile.txt";
echo $_SERVER['DOCUMENT_ROOT'];
$fh = fopen($myFile, 'w+') or die("can't open file");
$str = "";
$res = mysql_query("SELECT `login`, `firstname`, `lastname`, `email`, `b_address`, `b_city` FROM `xcart_customers` where usertype = 'C' ") or die(mysql_error());
while($row = mysql_fetch_object($res))
{
$stringData = $row -> login.",".$row -> firstname.",".$row -> email.",".$row -> b_address.",".b_city."\n";
$str .= $stringData;
}
$stringData = $str;
fwrite($fh, $stringData);
$fname = "testFile.txt";
header("HTTP/1.1 200 OK");
header("Content-Type: application/force-download");
header("Content-Disposition: attachment; filename=$fname");
header("Content-Transfer-Encoding: binary");
echo readfile('testFile.txt');
?>
for the above code after changing right got following error :
/home/digiqui/public_html
Warning: Cannot modify header information - headers already sent by (output started at /home/digiqui/public_html/test.php:9) in /home/digiqui/public_html/test.php on line 26
Warning: Cannot modify header information - headers already sent by (output started at /home/digiqui/public_html/test.php:9) in /home/digiqui/public_html/test.php on line 27
Warning: Cannot modify header information - headers already sent by (output started at /home/digiqui/public_html/test.php:9) in /home/digiqui/public_html/test.php on line 28
Warning: Cannot modify header information - headers already sent by (output started at /home/digiqui/public_html/test.php:9) in /home/digiqui/public_html/test.php on line 29