SQL / PHP Problem
-
I don't know if I should put this under php or sql, but it is a little of both. I have secure info that I do not want published to a file on the server at any time even a few seconds. I just want to take it strait out of the data base and have the person click a link, to this php file below and when they go to it it prompts them to download. I want the sql info in the file. I think I have most of the code right, but it isn't quite working. As of now, it is downloading a blank file.
function show_file_information($filename) { @readfile($filename); } if(!class_exists(MySQL)) { require '../home/MySQL.php'; require '../home/conf_global.php'; $mysql = new MySQL(); $mysql->connect($INFO['sql_user'],$INFO['sql_pass'],$INFO['sql_database'],$INFO['sql_host']); } $news_result = $mysql->query("SELECT * FROM newsletters WHERE id='1'"); $news = mysql_fetch_assoc($news_result); $filename = $news['add_id']; header("Pragma: public"); header("Expires: 0"); header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); header("Content-Type: application/force-download"); header("Content-Type: application/octet-stream"); header("Content-Type: application/download"); header("Content-Disposition: attachment; filename=".basename(emaillist).".txt"); header("Content-Transfer-Encoding: binary"); header("Content-Length: ".strlen($filename)); //@readfile("$filename"); ?>
LOSTTWARE.com My site allows for people to develop private programming teams, with password protected forums for each team.