What I've done is I set up an INPUT box on the site, where you type in your
e-mail address.  Upon hitting submit, I query the database looking for the
persons e-mail address.  If it's there, I send it to them, if not I inform
them that they aren't in the database.  This is the code I use for
http://www.sohh.com/wireless

Hope this helps.

if ($email) {

        $db = "vb114";

        include("../application_db_connect.php");

        $query_checkemail = "SELECT user.* FROM user WHERE user.email  = '$email'";

        $result_checkemail = mysql_query($query_checkemail);

        if (!$result_checkemail) {

                echo("Error performing query:  " . mysql_error());

                exit;

        }

        $recordcount_checkemail = mysql_num_rows($result_checkemail);

        if ($recordcount_checkemail) {

                while($row_checkemail = mysql_fetch_array($result_checkemail)) {

                        $username = $row_checkemail["username"];

                        $password = $row_checkemail["password"];

                        $mail_to = trim($email);

                        $mail_headers = "From: [EMAIL PROTECTED]\r\nReply-to:
[EMAIL PROTECTED]";

                        $mail_subject = "Your login details for SOHH.com:";

                        $mail_body .= "Username = $username\n";

                        $mail_body .= "Password = $password\n\n";

                        $mail_body .= "Don't forget that they are case sensitive!\n\n";

                        $mail_body .= "To sign up to SOHH Wireless, go to:\n";

                        $mail_body .= "http://www.upoc.com/sohh/\n\n";;

                        $mail_body .= "Yours,\n\n";

                        $mail_body .= "SOHH.com Team\n\n";

                        mail($mail_to, $mail_subject, $mail_body, $mail_headers);

                        $message = "<p>Your e-mail address, <b>$email</b>, is already 
in our
database.  This means you are already a member of SOHH.com and can join SOHH
Wireless.</p><noscript><p>You're ready to <a href=\"upoc_offer.php\"
target=\"_top\">sign up for SOHH Wireless!</a></p></noscript><p>For future
reference, we have sent your username and password to <b>$email</b>.</p>";

                }

        } else {

                $message = "<p>Your e-mail address, <b>$email</b>, is not in our 
database.
This means you are not a member of SOHH.com.  <a
href=\"sign_up.php?username=guest&password=guest\">You should join
now!</a></p>";

        }

} else {

        $message = "<p>You didn't enter your e-mail address!</p>";

}

-----Original Message-----
From: DC [mailto:[EMAIL PROTECTED]]
Sent: Thursday, April 26, 2001 12:04 AM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Sending the user their forgotten password via emal??


Hi all

I would like to offer my users the chance to have their username and
password sent to them via the email address stored.

As i see it i have two issues

(1) how do i do the verify email thing where the script send a click here to
confirm email address on registration application

(2) how do i then send their details (username / password) to the confirmed
stored email address.

I have looked around but cqnt find the answer.....

5 books on the shelf give no clue either....

Any help is most apreciated

Thanks in Advance

Dave C



--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to