Jump to content

[SOLVED] Sending forgotten password!


andrew_biggart

Recommended Posts

Ok im having a little trouble creating a send forgotten password page! its doing my head in to be frank! i found a good example, copied it and got it working. Now im trying to intigrate it into my page but it wont work.

 

This is the example form.

<table width="380" border="0" cellpadding="3" cellspacing="1" >
<tr>
<td width="33%"><strong>Enter your email : </strong></td>
<td width="67%"><form name="form1" method="post" action="send_password_ac.php">
<input name="email_to" type="text" id="mail_to" size="25">USERNAME:
<input name="username" type="text" id="username" size="25">
<input type="submit" name="Submit" value="Submit">
</form>
</td>
</tr>
</table>

 

This is the php page, which works with the example but doesnt send the password with my form.

	<?

include("config_members.php");

// value sent from form
$email_to=$_POST['email_to'];
$username=$_POST['username'];
// table name

// value sent from form
$email_to=$_POST['email_to'];

// table name
$tbl_name=User_infoT;

// retrieve password from table where e-mail = $email_to(mark@phpeasystep.com)
$sql="SELECT Password FROM $tbl_name WHERE Email='$email_to' AND Username='$username'";
$result=mysql_query($sql);

// if found this e-mail address, row must be 1 row
// keep value in variable name "$count"
$count=mysql_num_rows($result);

// compare if $count =1 row
if($count==1){

$rows=mysql_fetch_array($result);

// keep password in $your_password
$your_password=$rows['password'];

// ---------------- SEND MAIL FORM ----------------

// send e-mail to ...
$to=$email_to;

// Your subject
$subject="www.weloveweed.co.uk | Your password !";

// From
$header="AdMiN <support@weloveweed.co.uk>";

// Your message
$header="from: AdMiN <support@weloveweed.co.uk>\r\n";
$messages= "You forgot your fucking pssword you twat. Dont let this happen to offer or I will start to get extremly fucked off! \r\n";
$messages.="Your password is $your_password, so remember it this time. \r\n";
$messages.="If you continue to have problems then please use the contact us section of weloveweed to report the problem and any error you are receiving. \r\n";
$messages.="Luff AdMiN  \r\n";
$messages .= "******************************This Is An Automatically Generated Message, Do Not Repond!";


// send email
$sentmail = mail($to,$subject,$messages,$header);

}

// else if $count not equal 1
else {
echo "<h1 class=comment_status2>You are not a registered member, please register to continue.</h1>";
}

// if your email succesfully sent
if($sentmail){
echo "<h1 class=comment_status1>Your Password Has Been Sent To Your Email Address.</h1>";
}
else {
echo "<h1 class=comment_status2>Cannot send password to your e-mail address.</h1>";
}

?>

 

And hear is my form which doesnt seem to work for some reason even know its the same!

	<form method="form1" action="send_password_ac.php">
<table class="style3">
<tr><td colspan="2" class="style4"><strong>Forgot your password? Don&#39;t worry!</strong></td></tr>
<tr>
<td class="myprofile_subtext">Your email address :</td>
<td><input name="email_to" id="mail_to" maxlength="100" type="text" /></td>
</tr>
    <tr>
    <td class="myprofile_subtext">Username :</td>
    <td><input name="username" id="username" maxlength="8" type="text" value="" /></td>
    </tr>
    <tr>
    <td colspan="2" class="style5"><input class="login23" name="submit" type="submit" value="Email password" /></td>
    </tr>
</table>
</form>

 

can anyone help?

Link to comment
Share on other sites

What I noticed immediately is that you have form1 for a method, but you're using POST.

 

Change that, in the example you were using they used name="form1" method="POST", you mixed them up.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.