Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Send verification email with link 1

Status
Not open for further replies.

Chomauk

Programmer
Jun 8, 2001
130
I have a site where a verification email is sent to the user after they've entered their info at my site. What I need to know is how do I email a link(with a unique ID) to which the user can click on to enter a page that will validate them on my database.
In essence:
I can already email the user(s) but how do I email a link so when it's clicked on it'll take the user to a page that will automically verify them on my MySQL DB?

Thanks

If you're going through hell, keep going.
--Sir Winston Churchill (1874 - 1965)
 
Some mail clients will take something that looks like a well-formed URL and make it behave like a link, even in a text message. Others do not.

What I recommend is that you send an email that contains the text containing the link both in plaintext and HTML as separate parts of a multipart MIME message.

PHPMailer is a PHP class which can make the sending of complex email messages less difficult.


Want the best answers? Ask the best questions!

TANSTAAFL!!
 
say the user id was 244.

the link would be something like
have a field called validated in ur table

validateuser.php

Code:
<?php
//do db connection

$uid = $_GET['uid'];

$q = mysql_query("UPDATE tblname SET validated = 'yes' WHERE uid = '$uid'") or die(mysql_error());

then when someone tries 2 login select the uid from the table then check if validated. something like:

Code:
$q = mysql_query("SELECT validated FROM tblname WHERE uid = '$uid' //presuming you got a uid from the login script

while(list($v) = mysql_fetch_row($q)){

if($v == "yes"){
echo "Validated";
}else{
echo "Click link in email";
}
}//end while loop

this might be a bit long winded. hope you understand!


Regards,

Martin

Gaming Help And Info:
 
Looks ok to me, I would generate a non obvious key though e.g. put the 244 through MD5
 
Thanks for the info... I'll try your code MJB3K and let you know how it goes.

Thanks again all

If you're going through hell, keep going.
--Sir Winston Churchill (1874 - 1965)
 
Worked great! thanks again.

If you're going through hell, keep going.
--Sir Winston Churchill (1874 - 1965)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top