Forum Moderators: coopster

Message Too Old, No Replies

incorporating session ID into a email validation

         

Flolondon

6:12 am on May 8, 2004 (gmt 0)

10+ Year Member




Please What is the best method of incorporating an session ID into an email validation.

What i want to do is to generate an rand hexade(unique identifer) from the email validation into the persons email box for which they should click on to registrar......

<?
function checkEmail($email) {

if (eregi("^[a-zA-Z0-9_]+@[a-zA-Z0-9\-]+\.[a-zA-Z0-9\-\.]+$]",
$email)) { return FALSE; } list($Username, $Domain) = split("@",$email);
if(getmxrr($Domain, $MXHost)) { return TRUE;

} else {

if(fsockopen($Domain, 25, $errno, $errstr, 30)) {

return TRUE;

} else {

return FALSE; }
if(checkEmail($_POST['email']) == FALSE){

echo" Sorry E-mail entered
is not valid.";

} else {

echo "Success - please go to your email and click
on the link to registrar!."; } }}
?>

john_k

6:26 am on May 8, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I simply store that random identifier in a comfirmation table that links to the ProfileId. The link I provide in the email is then like this:

www.example.com/confirm/abcde12345/1000

where "abcde12345" represents the random string and "1000" represents the ProfileId.

I then use a mod_rewrite (actually this is on IIS so it is a 404 error handler) to handle all requests into the "confirm" directory. That code extracts the random string and the ProfileId and does a lookup in the DB. This is a dual-key approach that requires both pieces of information to match.

Flolondon

7:35 am on May 9, 2004 (gmt 0)

10+ Year Member



ok, john, thanks. but what type of codes would you use in conjunction with the codes i listed above... Thanks

vincevincevince

12:18 pm on May 9, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I usually use MD5 based on the email address and some fixed characters

$code = md5($email."some_fixed_but_secret_string");

Then, when they come back and type/pass in the string you can test it as
if (md5($email."some_fixed_but_secret_string")==$what_they_entered)) then validate();

If the string is too long for your liking, just snip off the first half a dozen letters and use them