473,499 Members | 1,660 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Why does email not get sent in this password reset script?

18 New Member
Hello,

I have a password reminder script in my site.
The script displays "password sent to your email address" but the email would never reach you.
Please help

Expand|Select|Wrap|Line Numbers
  1. <?
  2. include 'dbb.php';
  3.  
  4. switch($_POST['recover']){
  5.     default:
  6.     include 'lost_pw.php';
  7.     break;
  8.  
  9.     case "recover":
  10.     recover_pw($_POST['emailad']);
  11.     break;
  12. }
  13. function recover_pw($emailad){
  14.     if(!$emailad){
  15.         echo "You forgot to enter your Email address <strong>Alumni</strong><br />";
  16.         include 'lost_pw.php';
  17.         exit();
  18.     }
  19.     // quick check to see if record exists    
  20.     $sql_check = mysql_query("SELECT * FROM user WHERE emailad='$emailad'");
  21.     $sql_check_num = mysql_num_rows($sql_check);
  22.     if($sql_check_num == 0){
  23.         echo "No records found matching your email address<br />";
  24.         include 'lost_pw.php';
  25.         exit();
  26.     }
  27.  
  28.  
  29.     $sql = mysql_query("select password from user WHERE emailad='$emailad'");
  30.  
  31.     $subject = "Your Password at our site!";
  32.     $message = "Hi, we have reset your password.
  33.  
  34.     Your password is: $password
  35.  
  36.     http://www.mysite.com
  37.  
  38.     Thanks!
  39.     The Webmaster
  40.  
  41.     This is an automated response, please do not reply!";
  42.  
  43.     mail($email_address, $subject, $message, "From: imostars Webmaster<alart@mysite>\nX-Mailer: PHP/" . phpversion());
  44.     echo "Your password has been sent! Please check your email!<br />";
  45.     include 'login.php';
  46. }
  47. ?>
  48.  
Jan 31 '11 #1
3 1921
Dormilich
8,658 Recognized Expert Moderator Expert
you should check the return value of the mail() function, that tells you if there was an error sending or not.
Jan 31 '11 #2
tutusaint
18 New Member
The script is sending the email without including the users password.
Feb 1 '11 #3
Markus
6,050 Recognized Expert Expert
You have not defined the $password variable anywhere.
Feb 1 '11 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

4
2219
by: Bryan Harrington | last post by:
Hello.. I'm trying to come up with a good way to have password requirements (i.e., length, Upper/Lower case mix, x number of Alpha, x number of numeric, etc.) configurable by installed site. The...
1
1961
by: Microlong® | last post by:
I use window object with close method to close a web page, this web page is designed by active server page and VBscript. the code is as follows: window.close() however, an alart messege comes from...
4
3116
by: splicemix | last post by:
Hi all, I have recently set up a Drupal website. I am a beginner. My shared host server does not allow nobody@localhost to send emails, and prevents access to php.ini, so I spent some time...
9
2784
by: Phil G. | last post by:
Hi all, I would like to create a very simple 'lite' version of Outlook Calendar's reminder function. I will use a windows service that will read timedate stamps from a db and compare them to...
1
1354
by: mandlamuki | last post by:
I doubt if there's anything wrong with the code i've used. The connection to the database works just fine. I receive the following error:Warning: Failed to Receive in c:\apache\htdocs\forgot.php on...
1
3080
by: Jeremy Simpson | last post by:
Has anyone tried to set a reminder in MS Outlook from with Access? I want to, when a checkbox is ticked automatically set a reminder in access that takes information from the current record i.e...
1
6076
by: groupie | last post by:
Hi, I'd like to know how to implement the "Forgot Password" feature on many websites which require a login, exactly like this ebay example:...
3
1258
by: papan | last post by:
how the google alart is made?
1
2270
by: THEAF | last post by:
OK, i've had quite a few problems with this form and again i have another one. i'm using vb6 and access. THIS IS MY FORM LOAD AND AFTER THE LOOP IS WHERE THE REMINDER CODE IS Private Sub...
2
1511
by: kite54surfer | last post by:
I am trying to visually remind myself to lock the MDE. I have a large "Do not Forget" label on my main form I tried many variations (obviously don't know what I am doing) of : If...
1
6905
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
5485
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
4921
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4609
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3108
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3103
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1429
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
667
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
311
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.