hi ppl,
cant figure out why the following isn't working, im trying to let a user download a file only once, now the download file message comes up but the pdf reader say's its corrupt/illegal...please help
Script 1:
second script the above script redirects to:PHP Code:<?php
include( "class.DatabaseConnect.php" );
session_start( );
$check=$_GET['des'];
$dbConn = new DatabaseConnect( );
$dbConn->connect( "workdb" );
$sqlResult8 =
$dbConn->executeQuery("select downloaded from design_tbl where pdf_path='$check'");
$temp8= mysql_fetch_array($sqlResult8);
$pdf=$temp8['downloaded'];
if($pdf==0)
{
sqlResult9 =
dbConn->executeQuery("update design_tbl set downloaded=1 where pdf_path='$check'");
$file = $_GET['file'];
header('location:getit.php?f='.$file.'');
}
if($pdf==1)
{
echo "File already downloaded, contact system admin";
}
?>
PHP Code:<?php
header('Content-Type: application/pdf');
header('Content-Disposition: attachment; filename=mydesign.pdf');
readfile($_GET['f']);
?>



Reply With Quote
)

Bookmarks