Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
0

Forget Password Page

New Here ,
Jun 07, 2011 Jun 07, 2011

Copy link to clipboard

Copied

I have all ready set up a user_registration table that contains the information that I am trying to retrieve. Nonetheless, the send_password_ac.php is unable to locate the email address in the database that is in the database. I have created a forget the forgot_password.php (search page not shown) and I have created the send_password_ac.php (results page) see below:

//Connect to server and select databse.

mysql_connect("$host", "$username", "$password")or die("cannot connect to server");

mysql_select_db("$db_name")or die("cannot select DB");

// value sent from form

$register_pemail_to=$_POST['register_pemail_to'];

// table name

$tbl_name="user_registration";

// retrieve password from table where email = $register_pemail_to…

$sql="SELECT register_pass FROM $tbl_name WHERE register_pemail='$register_pemail_to'";

$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['register_pass'];

When the code is run what I get in return is “Could not find email in database. Please try again”. So, I know I am able to connect to the database but what I don’t get is why it is not able find email field (register_pemail) in the database. Any help would be appreciated.

hjohnson2011

TOPICS
Server side applications

Views

337
Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Jun 08, 2011 Jun 08, 2011

Copy link to clipboard

Copied

I can't comment on why you're not retrieving email from your query because you have not provided enough information regarding the issue.

I can comment on the code you have provided though. Basically, it's unsecure. You might as well be posting your database username and password on your website with big red letters in 60px font that says hey everybody, go ahead and hack my database. Fix the vulnerabilities of injection attack in your query.

If you were using Dreamweaver to produce your query then you would be protected against injection attacks in your query... You're in the Dreamweaver forum asking Dreamweaver questions, aren't you? Try using Dreamweaver then, just a suggestion.

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jun 08, 2011 Jun 08, 2011

Copy link to clipboard

Copied

LATEST

Got it!

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines