mysql - Easiest way for PHP email verification link -
mysql - Easiest way for PHP email verification link -
i have advanced user login/register scheme on website (colemansystems.psm2.co.uk). however, have email sent new users verification of email address. if have not clicked link not able access account. semi-experienced php , mysql, please explain in depth.
edit: code i'm using verify.php
file (the link user click on (for example, verify.php?d=51773199320
))
$secret = $_get['d']; $result = mysql_query("select valid users secret=$secret"); while ($row = mysql_fetch_array($result)) { $valid = $row['valid']; } if ($valid == "") { echo"there seems problem verification code.<br><br><br><br><br>"; } elseif ($valid == "1") { echo"your business relationship verified.<br><br><br><br><br>"; } else { mysql_query("update users set valid = '1' secret=$secret"); echo "thank you, business relationship verified , free utilize exclusive features!<br><br><br><br><br><br>"; }
is secure?
the easiest way not register unverified users @ all.
ask them email address , send email link contains address sealed hash. upon receiving link can start registration process.
something this
$secret = "35onoi2=-7#%g03kl"; $email = urlencode($_post['email']); $hash = md5($_post['email'].$secret); $link = "http://example.com/register.php?email=$email&hash=$hash";
and in register.php
add together 2 hidden fields registration form - email , hash, storing received values get.
finally, process registration , check,
if (md5($_post['email'].$secret) == $_post['hash']) { //continue registration. }
php mysql email verification
Comments
Post a Comment