Verify email with codeigniter

Yustme picture Yustme · Aug 6, 2010 · Viewed 9.1k times · Source

How can I verify an email address with codeigniter? I just went through the manual, I couldn't find this.

With email verification, i mean the exact same verification you see when registering on a community forum.

Thanks in advance!

Answer

Matthew picture Matthew · Aug 6, 2010

Use the Email Class to send the email. The email could contain a link with a "secret key", something random and hash-like, like 5dfg7898ssdf (I made that one up :) ). The link could point to: example.com/verify/user/5dfg7898ssdf Then in a codeigniter controller called "verify", you put this function (just some quick code):

function user($key = NULL)
{
 if($key)
 {
  // Find key in database
  // If it exists, then mark
  // the corresponding user as "activated"
 }
}