CodeIgniter Forums
General design question - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: General design question (/showthread.php?tid=26942)



General design question - El Forum - 01-27-2010

[eluser]bennyhill[/eluser]
When you sign up for a new user account for a forum, it sends you and email telling you to click a link to activate your account. What is going on in the background with the database? Do you just send the link to a function in a controller and then change a field in a record set, say to, "authorized" ? Basically I am just wondering how to construct this functionality of authorizing accounts (changing a database entry) via a link in an email.


General design question - El Forum - 01-27-2010

[eluser]bretticus[/eluser]
I typically generate a GUID (random string that I hash.) The CI string class has a random_string() function that is useful or you can use the database to generate something for you. I store that with the new user's pending record in the database. Then I send them the link. The link is a reference to a controller/method with the GUID tacked on the end (ie. http://mysite.tld/users/confirm/2u43h5kj2k35hkjh3456.) The next step is checking that GUID in the database and changing the user record from pending to confirmed (or however you want to represent these states.)

That's it in a nutshell.


General design question - El Forum - 01-27-2010

[eluser]bennyhill[/eluser]
Great thanks for the quick response.