function dload($phpfile, $content)
{
header('Pragma: public');
header('Cache-Control: private');
header('Cache-Control: no-cache, must-revalidate');
header('Accept-Ranges: bytes');
header('Content-Length: ' . strlen($content));
header('Connection: close');
header("Content-Type: text/plain");
header('Content-Disposition: attachment; boundary=inner; Content-description: ceva dragutz; filename="'.$phpfile.'"');
print $content;
die();
}
function read_sql($id,$tip)
{
//require('mysql.inc.php');
$serverdb='localhost';
$userdb='eas';
$passdb='eas';
$database='eas_new';
$link = mysql_connect($serverdb,$userdb,$passdb) or die(mysql_error());
$db = mysql_select_db($database,$link) or die(mysql_error());
if($continut=mysql_fetch_array(mysql_query("SELECT * FROM $tip WHERE id=\"$id\"")))
{
if($tip=="documente_produse")
{
$content=mysql_result(mysql_query("SELECT file FROM fisiere_produse WHERE id=\"$continut[id]\""),0);
}
else
{
$content=$continut['file'];
}
$phpfile=$continut['filename'];
//echo 'incepe functia';
dload($phpfile, $content);
//echo 'se termina functia';
}
mysql_close();
}
session_start();
if($_SESSION[username] or $_SESSION[usr_adm] or $_GET[linkid]==md5("email"))
{
if($_GET[id] and $_GET[tip])
{
read_sql($_GET[id],$_GET[tip]);
}
else
{
echo '