user1583040
user1583040

Reputation: 1

php How to send user email to activate their account

I'm doing a simple login page. Want to confirm the user account by sending them a link in their email when they sign up. So when they click on it, their account is activated. How do i do this? Only have a basic form.

...etc

Upvotes: 0

Views: 1266

Answers (2)

Oliver Jakoubek
Oliver Jakoubek

Reputation: 451

You should create a kind of a hashed ID to identify the user. Put that ID into the verification URL instead of the user id to allowed only the "real" user to verification historischen account/email address.

Example: .../verify/g5jd31zcxh7kob

Upvotes: 0

Brad Reed
Brad Reed

Reputation: 443

You want a boolean field in your database called "activated" or something. When the user signs up, make it false. Then use the mail() function to send an email with a link to an activation page. Something like www.example.com/activate.php?user_id=123

In that page you just want to find the user with that id, ask them to confirm their password and update the "activated" field to be true.

Upvotes: 1

Related Questions