TalkPHP
 
 
Account Login
Latest Articles
» The basic usage of PHPTAL, a XML/XHTML template library for PHP
» Vulnerable methods and the areas they are commonly trusted in.
» Simple way to protect a form from bot
» The Basics On: How Session Stealing Works
» How to keep your forms from double posting data
IRC Channel
IRC Speech Bubble Join the friendly bunch on IRC...
(#TalkPHP on Freenode)

...Also available via a web interface.

See this thread for information on the TalkPHP Free Hugs Initiative™. Subject to availability.
Associates
Associates
CSS Tutorials
Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old 02-09-2008, 08:27 PM   #1 (permalink)
Alan @ CIT
Member of the Month
The Frequenter
Member of the Month Top Contributor 
 
Alan @ CIT's Avatar
 
Join Date: Apr 2005
Location: South UK
Posts: 483
Thanks: 51
Alan @ CIT is on a distinguished road
Default Email Verification Class

Hi all,

I wrote this class for a friends company and for the sake of convienance they have agreed to let me release it as public domain which means I can also release it here

It is a class that helps you to produce/send/confirm those "Verifiy your email address" emails that most websites send nowadays.

It allows you to add an email address / confirmation code to the datastore, it then sends the confirmation email, then provides a method for you to verifiy the confirmation code when the link is clicked.

By default it supports a MySQL datastore for storing your email addresses but can be easily extended to support other formats. I've added (untested) support for Sqlite to give you an example of how to extend it.

From the readme.txt:

Quote:
----------------------------
Email Verification Class
Written by Alan Wagstaff
Donated to the Public Domain
----------------------------

This class allows you to send confirmation emails to your users when they register asking them to click on a link to confirm their email address. It then updates their email address record to indicate it is confirmed.

It supports different types of datastore, the provided one being MySQL.

The class Email_Verification_Storage_Abstract can be extended to support other systems (ie, Sqlite, CSV) as required - see Email_Verification_Storage_Mysql for an example.

The MySQL table it uses to store the email addresses should look something like:

-----
id (int, auto_increment, primary key)
email_address varchar(150)
confirmation_code varchar(50)
confirmed tinyint(1)
-----

You will need to create this yourself or more likely, merge support into your existing users table to avoid duplication.

An example email template is included in "classes/email_template.txt" - edit it to suit your needs. If you want to parse more placeholders (ie, users first name), then the code for it can be found in "classes/Email_Verification.php" around line 288.

One thing to watch for - this class throws a lot of exceptions if it runs into a problem (see Exceptions.txt for a full list) so be sure to catch them in your code - if they pass by un-caught your script will die rather spectacularly.

This code is donated to the public domain. For those young enough to not remember the days before GPL, MIT, BSD and all the other open source licences, the "Public Domain" means that you can do whatever you wish with the code, including stealing it and claiming you wrote it if you so desire.

This code is completely unsupported but I'll try to answer any questions that you have - email me at alan@php.net or visit http://www.talkphp.com/ and ask the friendly PHP community for help
It should generally work but if you run into any problems, feel free to ask

If you are particularly bored, feel free to use/abuse/improve the class. In particular, it could do with some refactoring and I did intend to add support for CSV and XML datastores but didn't get around to it.

Hope it's useful for someone

Alan
Attached Files
File Type: zip Aston.zip (9.9 KB, 44 views)
Send a message via MSN to Alan @ CIT
Alan @ CIT is offline  
Reply With Quote
The Following 3 Users Say Thank You to Alan @ CIT For This Useful Post:
Jelmer (02-11-2008), ReSpawN (02-09-2008), Wildhoney (02-10-2008)
Old 02-09-2008, 08:58 PM   #2 (permalink)
The Frequenter
 
ReSpawN's Avatar
 
Join Date: Nov 2007
Location: Netherlands
Posts: 460
Thanks: 49
ReSpawN is on a distinguished road
Default

Awesome, gonna try it right away Alan!
__________________
"Life is a bitch, take that bitch on a ride"
Send a message via MSN to ReSpawN
ReSpawN is offline  
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


All times are GMT. The time now is 07:49 AM.

 
     

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Inactive Reminders By Icora Web Design