View Full Version : PHp script to email download link
chetanmadaan
05-28-2009, 12:11 AM
Guys... i am looking for a php script in which a users submit his email and/or name in a form and a link should be emailed to him to download the file.
just basic email verification.
Thanks in advance.
www.jm-experts.com
bluewalrus
05-28-2009, 03:10 AM
What do you mean by file a specific file by user or all users get the same file?
chetanmadaan
05-28-2009, 09:15 AM
all users get the same file!
Thanks!
chetanmadaan
05-28-2009, 01:48 PM
help please!?
forum_amnesiac
05-28-2009, 02:43 PM
Here is a small script that will email a link to an email address
You can use it by creating a Form in HTML and calling this as the action and using method="POST".
Remember that the fields in your Form need to be the same as those in the script, ie name and email.
Save this script as a PHP file with a name and that is the name to call for the action
<?php
//variables
//form contents
$txtName=$_POST['name'];
$txtDemande=$_POST['email'];
$txtName = str_replace(array("\n","\r"),'',$txtName);
$txtEmail = str_replace(array("\n","\r"),'',$txtMail);
$txtLink = "put your link here";
$Myemail="your email address here";
$message ="This is your Link :\t$txtLink\n
\n"
$subject = "Your Link is Here";
$mailheaders = "From: $Myemail <> \n";
$mailheaders .= "Reply-To: $Myemail\n\n";
$theiremail = $txtEmail;
//send mail
mail($theiremail, $subject, $message , $mailheaders);
?>
chetanmadaan
05-28-2009, 09:12 PM
having this error!
Parse error: syntax error, unexpected T_VARIABLE in /homepages/46/d215152416/htdocs/clbiz78/form/form.php on line 15
chetanmadaan
05-28-2009, 09:12 PM
you can see it here:
http://www.jm-experts.com/form/
Schmoopy
05-28-2009, 09:55 PM
It's missing a semicolon after the $message variable, here's a fixed version:
<?php
//variables
//form contents
$txtName=$_POST['name'];
$txtDemande=$_POST['email'];
$txtName = str_replace(array("\n","\r"),'',$txtName);
$txtEmail = str_replace(array("\n","\r"),'',$txtMail);
$txtLink = "put your link here";
$Myemail="your email address here";
$message ="This is your Link :\t$txtLink\n
\n";
$subject = "Your Link is Here";
$mailheaders = "From: $Myemail <> \n";
$mailheaders .= "Reply-To: $Myemail\n\n";
$theiremail = $txtEmail;
//send mail
mail($theiremail, $subject, $message , $mailheaders);
?>
chetanmadaan
05-29-2009, 02:52 AM
alright... it's not showing any error right now but even not sending email.
http://www.jm-experts.com/form/
forum_amnesiac
05-29-2009, 05:59 AM
Sorry about that, typo on my part, I defined $_POST['mail'] into the wrong variable name, this version should send an email.
<?php
//variables
//form contents
$txtName=$_POST['name'];
$txtMail=$_POST['email'];
$txtName = str_replace(array("\n","\r"),'',$txtName);
$txtEmail = str_replace(array("\n","\r"),'',$txtMail);
$txtLink = "put your link here";
$Myemail="your email address here";
$message ="This is your Link :\t$txtLink\n
\n";
$subject = "Your Link is Here";
$mailheaders = "From: $Myemail <> \n";
$mailheaders .= "Reply-To: $Myemail\n\n";
$theiremail = $txtEmail;
//send mail
mail($theiremail, $subject, $message , $mailheaders);
?>
chetanmadaan
05-29-2009, 03:24 PM
Perfect...
last but not the least thing... can i display a message i.e. "Email Sent Thanks!" or something like that???
forum_amnesiac
05-29-2009, 03:30 PM
That's easy enough, in the PHP file, after the ?>, you can start an HTML file.
Eg
?>
<HTML>
<head>
</head>
<body>
</body
</HTML>
Then just put your scripts, styles, etc in the head section, your divs, tables, etc in the body, as normal
chetanmadaan
05-29-2009, 06:08 PM
alright... everything is very much perfect!
just the last things... can we create a session id along with every link so that it should last for only 15 or 20 mins... i mean i don't want the visitors to pass over the link.
i know this is some database thing included... but please let me know???
chetanmadaan
05-31-2009, 01:59 PM
??? help please!
www.jm-expertscom
forum_amnesiac
05-31-2009, 03:07 PM
I don't know if you will find this helpful but it is similar to what you are trying to do.
http://www.ardamis.com/2008/06/11/protecting-a-download-using-a-unique-url/
Powered by vBulletin® Version 4.2.2 Copyright © 2021 vBulletin Solutions, Inc. All rights reserved.