Re: mail and mysql confirmation of that [double-opt in]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



At 4:55 PM +0200 6/29/09, Grega Leskovsek wrote:
how is the best way to check if email address is valid: is this preg_match() OK?
preg_match('/^([a-zA-Z0-9])+([a-zA-Z0-9\._-])*@([a-zA-Z0-9_-])+([a-zA-Z0-9\._-]+)+$/',
$email);

How can I make double opt-in mail system? My idea:
1.) I remember the email entered and user data and the sha1($email);
in mysql db
2.) I send email with activation link of the sha1($email);
3.) I am not clear how to proceed when the link is activated. How to
update the db and submit the necessary form to the marketing.

Thanks in advance,

Double opt-in.

1. Have the user enter their email address via a form that let's them know they are subscribing to a service. You might want to check for a valid email address (many versions) and/or a CAPTCHA. additionally, you need to check if they have already registered OR in the process of registering.

2. After they submit their email address, then have your script create a unique token and record it coupled with the email address in your database.

3. Then send a confirmation email to that email address with the token appended as a link in the email -- with instructions for the receiver to either ignore the email (with apologies) or click the link and be taken back to your site where your script takes the confirmation token and checks your database for a token/email match. If there is one, then that completes the process and you have a confirmed double opt-in email address to use. If not, have them try again.

Here's the script I wrote to do that:

http://www.webbytedd.com/b/sub-email/index.php

Cheers,

tedd

--
-------
http://sperling.com  http://ancientstones.com  http://earthstones.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux