Hello all,
I came here a few days ago to get help with my php script and I got what I needed but I ran into another issue that I can’t seem to figure out. When the client enters their email address, the DL activates as expected. But, If you put nothing in the field … it still activates. Now I assumed this was because of the order of the code so I rearranged it, but I can’t seem to get it to work. So here it is before I tried to make the rearrangement:
<?PHP // Define the path to file $file = 'The_gate_vg.pdf'; // Set headers header("Cache-Control: public"); header("Content-Description: File Transfer"); header("Content-Disposition: attachment; filename=$file"); header("Content-Type: application/zip"); header("Content-Transfer-Encoding: binary"); // Read the file from disk readfile($file); // continue the rest of the php script u want in this dbform.php.. the script that deals with the post data of the form.. $email = $_REQUEST['email'] ; $message = $_REQUEST['message'] ; if (!isset($_REQUEST['email'])) { header( "Location: http://www.example.com" ); } elseif (empty($email)) { ?><html>
<head><title>Error</title></head>
<body>
<h1>Error</h1>
<p>
Oops, it appears you did not enter your
email address correctly. Please press the BACK
button in your browser and try again.
</p>
</body>
</html>
<?php
}
else {
mail( "[email protected]", “This person downloaded the ebook”,
$message, “From: $email” );
}
?>
Anyone that can help my with the correct code placement so I get the result I need?? i.e. - Client enters email … download begins … Client enters email incorrectly … they are redirected to the form.
Thank you SOO Much for any help!!!
Loudvox