Here is my code:Your Password for Wholesale at xxxxxxxxxxxxx.com is
Go here to login http://www.xxxxxxx.com/login.php
Code: Select all
<?php
require_once('db_fns.php');
//creating short variable name
$email = $HTTP_POST_VARSї'email'];
if (notify_password($email, $password))
{
echo 'Your password has been sent to your email address.';
}
else
echo 'Your email address is not in the database.'
.' Please send email to email@xxxxxxx.net to request password.';
?>Code: Select all
<html>
<head>
<title>Forgot Password</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="includes/style-sheet.css" rel="stylesheet" type="text/css">
</head>
<body>
<p> </p>
<p class="bodytxt">Fill in your email address, and we will email your password.</p>
<form method="POST" action="sendpass.php">
<p><input type="text" name="email" size="37"></p>
<p><input type="submit" value="Submit" name="B1"></p>
</form>
<p> </p>
</body>
</html>Code: Select all
<?php
function db_connect()
{
$result = mysql_pconnect('MySQLHost', 'xxxxxxxx', 'xxxxxx');
if (!$result)
return false;
if (!mysql_select_db('xxxxxx'))
return false;
return $result;
}
function notify_password($email, $password)
// email password to user
{
if (!($conn = db_connect()))
return false;
$result = mysql_query("select * from tbl_scmember
where email='$email'");
if (mysql_num_rows($result)==0)
{
return false; // email not in db
}
else
{
$email = mysql_result($result, 0, 'email');
$from = "From: info@xxxxxx.com \r\n";
$mesg = "Your Password for xxxxxxx is $password \r\n"
."Go here to login http://www.sxxxxxxxxx.com/login.php \r\n";
if (mail($email, 'Password for xxxxxxxxx', $mesg, $from))
return true;
else
return false;
}
}
?>feyd | Help us, help you. Please use
Code: Select all
andCode: Select all
tags where approriate when posting code. Read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]