View Full Version : auto generate random number then send to register
Erica
November 27th, 2004, 04:57 AM
I want to make a registration form that ensure registers enter their email address, then the system auto generates a 8-digit random number and send this number to the email.
The problem are:
1. how to generate the random number
2. how to send this number to the email
3. how to store both email and the number into SQL or a simple text file.
Thanks.
λ
November 27th, 2004, 05:50 AM
Generating 8-digit random number:
$rand_num = "";
for ($i = 0; $i < 8; $i++) {
$rand_num .= rand (0, 9);
}
To send the number in an email (assuming email is $email);
$email_text = <<<EOF
Thank you for registering for our service. Your unique registration code is $rand_num.
<other text here>
EOF;
if (!mail ($email, "Thank you for registering for our service!", $email_text, "From: service@service.com")) {
// an error has occured
} else {
// everythang's good
}
Erica
November 28th, 2004, 04:15 AM
Generating 8-digit random number:
$rand_num = "";
for ($i = 0; $i < 8; $i++) {
$rand_num .= rand (0, 9);
}
To send the number in an email (assuming email is $email);
$email_text = <<<EOF
Thank you for registering for our service. Your unique registration code is $rand_num.
<other text here>
EOF;
if (!mail ($email, "Thank you for registering for our service!", $email_text, "From: service@service.com")) {
// an error has occured
} else {
// everythang's good
}
Hi njs12345,
I want to ask the codes are PHP or AS in flash?
And anybody teach me how to store email and the number in a text file?
Powered by vBulletin® Version 4.1.10 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.