473,566 Members | 2,785 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 1927
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
2227
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 two customers that I'm working with on this app right now have 2 very different password requirements, I'd rather not have to re-write the signup...
1
1963
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 IE. It's details: The Web page you are viewing is trying to close the windows. Do you want to close this windows? I want to directly close the...
4
3121
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 getting a SMTP script running. While the Drupal feedback module and the new account creation works fine in terms of sending of mails, I am having some...
9
2790
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 Now. This seems that it will create a lot of processor overhead in terms of 'how often shall I check the db?'. I wonder if I check it hourly and save...
1
1365
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 line 147. I'm thinking this has to do with the rsion of php that i'm using. I'm using PHP TRIAD.
1
3086
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 "Required: <<Current Date>- Single Line Diagram for <<Site Name>> Many thanks in advance, Jeremy
1
6081
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: http://cgi4.ebay.com/ws/eBayISAPI.dll?UserIdRecognizerShow I've already retrieved the users password from the database - I just need to send it to the email address entered. From reading many posts,...
3
1266
by: papan | last post by:
how the google alart is made?
1
2275
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 Form_Load() ' Dim s() As String Dim ListTime As String Dim ListDate As String Dim i As Integer
2
1514
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 AllowBypassKey = True Then Me!lblLock.Visible = False Else
0
7888
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8108
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7644
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7951
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6260
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5484
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3643
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3626
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1201
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.