[PHP-WIN] email confirmation

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Maybe someone can give me a heads up on this code.

Ideally what I am looking for is this:

The user submits their email address for registration.

Before the e-mail gets submitted to a database, if it's bogus the user does
not get an e-mail confirmation sent back to them.

However, If it's a vaild email address, the user gets an e-mail confirmation
with a link that incorporates a md5() hash of the email address for
insertion into a mySQL database.

Problems:

When I submit the form I receive an e-mail with an active link which
encompasses the complete string.

I wanted the users email address and $secret_variable to be concentated and
then passed to a md5 function call to be stored in the $confirmation_ID
variable.  That isn't happening.

Any assistance will be greatly appreciated.  Here's the code...

Thank you.
Tony Ritter
.....................................

/*the .html form which takes a name and an e-mail address */

<html>
<body>
<form action="process_a.php" method="post">
<p>
Your name:<br>
<input type="text" name="name"><br>
Your e-mail address:<br>
<input type="text" name="email"><br>
<input type="submit" name="submit" value="submit">
</body>
</form>
</html>
...............


/*process_a.php: which receives the name and email variables.  The script
then tries to then send the note back to the user with a link - called
CLICK.  When the user hits the link to email_verify.php the email address is
inserted into the database*/

<?
 $msg = "Thank you for registering $name\n\n";
 $msg .= "<a
href=tony@gonefishingguideservice.com/email_verify.php?email=$email&confirma
tion_ID=$confirmation_ID>CLICK</a>";
 $secret_variable = "something_only_you_know";
 $confirmation_ID = md5($email.$secret_variable);
 $to="tony@gonefishingguideservice.com";
 $subject="Thank you for registering";
 $mailheaders="From: Us";
 mail($to,$subject,$msg,$mailheaders);
?>
.............

// email_verify.php

<?
if ($_GET['confirmationID'] = md5($_GET['email'].$secret_variable)) {
    // insert the user into the database
} else {
  // display an error message
}
?>




-- 
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Database Programming]     [PHP Install]     [Kernel Newbies]     [Yosemite Forum]     [PHP Books]

  Powered by Linux