QUOTE
1) Login and Register.
How does blogging site (or simply any site with userbase) send activation link which would work?
How to implement it from scratch theoretically, and how to implement with the help of frameworks, if any?
How does blogging site (or simply any site with userbase) send activation link which would work?
How to implement it from scratch theoretically, and how to implement with the help of frameworks, if any?
I have done a activation code generation, as below, is this acceptable?
CODE
$key = rand(100000,999999);
$insertSQL = "INSERT INTO users(username,name, password ) values(?,?,?)";
$stmt = $con->stmt_init();
$stmt = $con->prepare($insertSQL);
$stmt->bind_param("sss",$email,$key,$password);
$stmt->execute();
$stmt->close();
$to = $email;
$subject = 'Activation Code';
$msg = "Please click this link below to activate your account on yourdomain.com:\n\nhttps://yourdomain.com/phpdemo/activate.php?email=" . $to . "&key=" . $key;
$msg = wordwrap($msg,70);
mail($to, $subject, $msg);
$insertSQL = "INSERT INTO users(username,name, password ) values(?,?,?)";
$stmt = $con->stmt_init();
$stmt = $con->prepare($insertSQL);
$stmt->bind_param("sss",$email,$key,$password);
$stmt->execute();
$stmt->close();
$to = $email;
$subject = 'Activation Code';
$msg = "Please click this link below to activate your account on yourdomain.com:\n\nhttps://yourdomain.com/phpdemo/activate.php?email=" . $to . "&key=" . $key;
$msg = wordwrap($msg,70);
mail($to, $subject, $msg);
So, I receive link in e-mail like this:
CODE
yourdoamin.com/phpdemo/activate.php?email=XXX&key=XXX
I see other platform has more complicated way used to activation link, but was my example above sufficient for small-scale application?