i just wondering how to send an activation code to emails after a user has registered or filled up the
form , what shall I do? help me Pls.
sending an activation code emails how????
Moderator: General Moderators
mail() the email to them
create an activation code, store it somewhere, check against it when the email is clicked or the activation code is entered.
generating an activation code can be as simple as using rand(), or as complex as you want it to be. I usually just go with something completely random like..
create an activation code, store it somewhere, check against it when the email is clicked or the activation code is entered.
generating an activation code can be as simple as using rand(), or as complex as you want it to be. I usually just go with something completely random like..
Code: Select all
$activationCode = substr(md5(microtime()), 0, mt_rand(5,12));Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.
I use the following two functions:
Which is my implementation of the Luhn Algorithm
Email clients like to wrap urls in weird ways.. making it common for the non-technically proficient to click on a truncated url or to copy and paste only half the number.
This way I can verify that the number is valid. If it's invalid, I can tell them right away that they didn't copy and paste the url correctly. If it is valid, but not found in the database, I can tell them that they've already verified their email address.
Code: Select all
function genID()
{
$num="";
for ($i=0;$i<15;$i++) $num.=rand(0,9);
$sum=0;
for ($i=0;$i<15;$i++)
{
$l=$num[15-($i+1)];
$sum+=($i&1)?$l:(($l*2)%9);
}
if ($sum%10) $num.=10-($sum%10);
else $num.="0";
return $num;
}
function checkID($id)
{
$sum=0;
$len=strlen($id);
for ($i=0;$i<$len;$i++)
{
$l=$id[$len-($i+1)];
$sum+=($i&1)?(($l*2)%9):$l;
}
return (($sum%10)==0);
}Email clients like to wrap urls in weird ways.. making it common for the non-technically proficient to click on a truncated url or to copy and paste only half the number.
This way I can verify that the number is valid. If it's invalid, I can tell them right away that they didn't copy and paste the url correctly. If it is valid, but not found in the database, I can tell them that they've already verified their email address.
Re: sending an activation code emails how????
I have a hunch that you are asking about how to send an email from PHP, rather than how to generate the activation code. scottayy gave you the short answer. If you are running PHP on a server that has an SMTP server configured, sending email is as easy as forming 4 strings and calling the function mail(). Do look up the reference scottayy gave you.junix wrote:i just wondering how to send an activation code to emails after a user has registered or filled up the
form , what shall I do? help me Pls.