Current time: 01-07-2009, 04:49 AM Hello There, Guest! (LoginRegister)
Quick Login:


Poll: ..
Suck
Good
[Show Results]
 
Post Reply  Post Thread 
[php]Confirm Email Before Download
Author Message
code
Member
***


Posts: 54
Group: Active
Joined: Feb 2006
Status: Away
Reputation: 0
Post: #1
[php]Confirm Email Before Download

this is my frist tut so dont hate on me!


1. Create a form where people can send ther email address at the bottom of the site's Terms Of Use page.
2. When the people agree to the Terms Of Use, they type in their email address and submit it.
3. After submitting, the owner of the site gets the visitor's email address and the visitor will receive an email (so it's important that the visitors send a valid email address) with the link to where the goodies can be downloaded.

Step 1: Submit Email Form
Let's assume that you have a Terms Of Use page named terms.php. Place this code after you've listed your terms:

PHP Code:
<center>
<
form action="confirmemail.php" method="post">
<
input type="text" name="Email" size="30">
<
input type="submit" value="I AGREE">
</
form>
</
center


Step 2: confirmemail.php
Let's make a file called confirmemail.php. We'll put a script here where we confirm if the email submitted is valid. This is also where the fun part is: sending an email to the visitor (the URL) and the owner (the visitor's email).

PHP Code:
<?php

// CHECKS IF AN EMAIL ADDRESS IS VALID
if (!eregi('^(.+)@(.+)\.(.+)$'$Email))
{
// ERROR MESSAGE IF EMAIL IS INVALID
echo "<p>You didn't enter your email. Press
the back button of your browser and
try again.</p>"
;
}

else
{
// EMAIL FOR THE VISITOR

// SUBJECT OF THE EMAIL TO THE VISITOR
$VisitorSubject "Confirm Email";

// TELLS THE VISITOR WHO IT'S FROM
$VisitorHeaders "From: \"[u]DANNY[/u]\"
<[u]owner@mysite.com[/u]>\n"
;

// MESSAGE TO THE VISITOR WITH THE URL
$VisitorMessage "[u]Thank you for your interest
in downloading my goodies.
Here's the link to them:
http://Gfx-depot.com[/u]"
;

// SEND EMAIL TO THE VISITOR
mail("$Email""$VisitorSubject",
"$VisitorMessage""$VisitorHeaders");


// EMAIL FOR THE OWNER

// OWNER'S EMAIL ADDRESS
$OwnerEmail "owner@mysite.com";

// SUBJECT OF THE EMAIL TO THE OWNER
$OwnerSubject "[u]Visitor Email[/u]";

// TELLS THE OWNER WHO IT'S FROM
$OwnerHeaders "From: \"[u]Site Visitor[/u]\"
<$Email>\n"
;

// MESSAGE TO THE OWNER WITH VISITOR'S EMAIL
$OwnerMessage "A visitor with this email,
$Email, [u]wants to download
your goodies.[/u]"
;

// SEND EMAIL TO THE OWNER
mail("$OwnerEmail""$OwnerSubject",
"$OwnerMessage""$OwnerHeaders"); 

// MESSAGE IN THE SITE FOR THE VISITORS
echo "[u]Thank you. The URL to download the
goodies was sent to your email.[/u]"
;


?>


Comments are already placed within the code to explain what they do. Just change the underlined text with your own preferences.

Edit FuniX: Putted the code into PHP-Tags
on: April The 22e 2006
Edit Xiao: Removed some weird sings from the code
on Jan 4 2008


code, proud member of GFX-Depot since Feb 2006.

This post was last modified: 01-04-2008 07:49 PM by Xiao.

04-21-2006 07:10 AM
Find all posts by this user Quote this message in a reply
Xiao
Administrator
*******
Administrators

Posts: 2,990
Group: Administrators
Joined: Dec 2005
Status: Offline
Reputation: 2
Post: #2
RE: [php]Confirm Email Before Download

cool, like that Smile2
Wrote it yourself?




I'm the only one around here that can ban people, what else do you need to know? Unsure
04-21-2006 03:49 PM
Visit this user's website Find all posts by this user Quote this message in a reply
code
Member
***


Posts: 54
Group: Active
Joined: Feb 2006
Status: Away
Reputation: 0
Post: #3
RE: [php]Confirm Email Before Download

Yea,im into php now lol was graphics now it PHP Ae-emo-1-89


code, proud member of GFX-Depot since Feb 2006.

04-21-2006 10:12 PM
Find all posts by this user Quote this message in a reply
FuniX
Senior Member
****


Posts: 747
Group: Active
Joined: Jan 2006
Status: Offline
Reputation: 4
Post: #4
RE: [php]Confirm Email Before Download

I've putted it into PHP-tags for you Smile2
so the Tags are highlighted


04-22-2006 10:13 AM
Find all posts by this user Quote this message in a reply
big-smoke
Junior Member
**


Posts: 21
Group: Active
Joined: Mar 2006
Status: Offline
Reputation: 0
Post: #5
RE: [php]Confirm Email Before Download

Simple but handy


http://www.webhog.be/index/artikels/
04-25-2006 06:56 PM
Find all posts by this user Quote this message in a reply
Post Reply  Post Thread 

View printable version View a Printable Version
Send this thread to a friend Send this Thread to a Friend
Subscribe to thread Subscribe to this Thread | Add to favourites Add Thread to Favorites

Forum Jump: