CodeIgniter Forums
confirmation email for user signup - 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: confirmation email for user signup (/showthread.php?tid=44270)



confirmation email for user signup - El Forum - 08-09-2011

[eluser]Brad K Morse[/eluser]
If I was using php w/o CI as the framework, I would display a activation link within the confirm email like: domain.com/[email protected]?key=0301002020

I have not done this in CodeIgniter and was wondering how I would accomplish getting ($_GET) both those variables to pass into a controller function?

something like?

domain.com/confirm/[email protected]/0301002020

Code:
function confirm() {
$segment_2 = $this->segment...
$segment_3 = $this->segment...

// rest of the confirmation code
}



confirmation email for user signup - El Forum - 08-09-2011

[eluser]IgnitedCoder[/eluser]
You got it right...

domain.com/confirm/email.com - but instead of using the email address...

Create a varchar 40 length field in your db, save the users details and generate a md5 or sha key you can store in this new field and use it for email conformation so its only 1 param to your controller function "confirm".

Step 1 - Signup

Step 2 - Grab confirm key field after record is saved

Step 3 send email as follows:

Pleae click here to confirm your email address domain.com/confirm/21730ASDRqWAFDGFD/

Confirm function would be as follows. This way your not sending a email in the URL.

Code:
function confirm($key=''){
  //update database field confirmed = 1 where key = $key
}

By far the safest way to do it.

Hope this helps.


confirmation email for user signup - El Forum - 08-09-2011

[eluser]Brad K Morse[/eluser]
Thanks!