[nycphp-talk] need another pair of eyes!
Kristina Anderson
ka at kacomputerconsulting.com
Wed Jul 23 17:28:51 EDT 2008
Hi everyone, I really need another pair of eyes to take a look at
this. I'm pretty sure this form needs to be submitted twice in order
to pass the post array to the included file (see code below)...is that
the only issue here..? this is a bare bones code sample which i will
have to integrate into my paypal app.
the code modification was prompted by the fact that the buyers were not
seeing an html page on my client's website before the download box
popped up, and this needs to be rectified.
Thanks in advance!
FILE 1 - testdowndisp.php
<?
$itemno = "333";
?>
<html>
<head>
<script language="javascript">
var flag = true;
function laLoad(){
if (flag) {
document.fred.submit();
//var flag = false;
}
}
</script>
</head>
<body onload="laLoad()">
Thanks for your purchase. The charge will appear on your statement as
Rough Draft P.<p>Welcome back to Proof Magazine website.
<form name="fred" action="testdowndisp.php" method="POST">
<input type="hidden" name="transid" value="<? echo $tx ?>">
<input type="hidden" name="pdfid" value="<? echo $itemno ?>">
</form>
<?
ob_clean();
include('downloadfile2.php');
//exit(0);
?>
</body>
</html>
FILE 2 -- downloadfile2.php
<?
$pdfid = $_POST['pdfid'];
$filename = $pdfid.".pdf";
//echo $pdfid."<br>";
//echo $filename."<br>";
//====
$path = '/usr431/home/p/r/proof/PDFs/';
$filesize=filesize($path.$filename);
header("Content-Type: application/pdf");
header("Content-Length: ".$filesize);
header("Content-Disposition: attachment; filename=$filename");
header("Content-Transfer-Encoding: binary");
readfile($path.$filename);
//fopen($path.$filename);
//===
?>
-- Kristina
More information about the talk
mailing list