omnath
omnath

Reputation: 509

get user confirmation activation link value

I'm using a confirmation link method to activation of user account in my website.when user submit the form, I send a link on user email address, with activation code. when user click on this link he redirect on my site registration page with value in address bar like http://showmycode.co.in/boobloom/[email protected]&activation_code=caU8xWxvYM how can check the email address and activation code for active the user status...and i get the value email address and activation code.

 $confirmLink = HTTP_PATH.'register'.'?'.'email'.'='.$to.'&'.'activation_code'.'='.$confirmationcode;

Upvotes: 0

Views: 2069

Answers (2)

Rohan Patil
Rohan Patil

Reputation: 2348

You can get the activation code and email by get method in php and check whether the emailid and activation code in database is same or not.If it is same then you can activate the account by changing the activation status.

$activation_code=$GET['activation_code'];
$email = $_GET['email'];

after that fire select query and check if record found then update the activation status.

Upvotes: 0

Jon
Jon

Reputation: 437554

If you mean how to read the incoming values, like this:

// most basic usage
$code = $_GET['activation_code'];
$email = $_GET['email'];

// now go on and activate the account

However, the above is not the best way to go about doing things (specifically, you want to avoid PHP notices if the URL does not contain the variables), so you would be better off writing a small helper function:

function param($name, $default = null) {
    return isset($_GET[$name]) ? $_GET[$name] : $default;
}

$code = param('activation_code');
$email = param('email');

Upvotes: 1

Related Questions