Welcome Guest, Not a member yet? Register   Sign In
confirmation email for user signup
#1

[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
}
#2

[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.
#3

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




Theme © iAndrew 2016 - Forum software by © MyBB