# Forgot password (flash and php) help with code

**URL:** <https://forum.kirupa.com/t/forgot-password-flash-and-php-help-with-code/154814>\
**Category:** Uncategorized\
**Created:** [July 12, 2005, 10:41pm UTC](https://forum.kirupa.com/t/forgot-password-flash-and-php-help-with-code/154814 "2005-07-12T22:41:04Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![mikal](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/mikal/32/1503_2.png) [@mikal](https://forum.kirupa.com/u/mikal)\
**Post date:** [July 12, 2005, 10:41pm UTC](https://forum.kirupa.com/t/forgot-password-flash-and-php-help-with-code/154814/1 "2005-07-12T22:41:04Z")

</div>

i have a script that sends the user the forgotten user name but not password.

For some reason this part is left blank.

**flashMX2004 code**

## frame1

Selection.setFocus(inpUserName);  
this.inpUserName.tabIndex = 0;  
this.inpEmail.tabIndex = 1;

this.btnSubmit.onRelease = function(){  
this.\_parent.submit();  
}

this.btnClose.onRelease = function(){  
gRoot.loadContent(“home.swf”, null, false);  
}

function submit(){  
if(this.inpUserName.text != “” && this.inpEmail.text != “”){  
if(gRoot.checkEmail(this.inpEmail.text)){  
this.txtResponse.text = “Sending message…”;  
var tVars = new LoadVars();  
tVars.owner = this;  
tVars.username = this.inpUserName.text;  
tVars.email = this.inpEmail.text;  
tVars.onLoad = function(){  
this.owner.txtResponse.text = this.msg;  
}  
tVars.sendAndLoad(gSystemPath + “forgot\_password.php”, tVars, “POST”);  
} else {  
this.txtResponse.text = “Please enter a valid email address.”;  
}  
} else {  
this.txtResponse.text = “Please fill in all fields and try again.”;  
}  
}

stop();

* * *

**PHP is**

* * *

\<?php  
include(“conn.php”);

$success = 1;

$username = $HTTP\_POST\_VARS[‘username’];  
$email = $HTTP\_POST\_VARS[‘email’];

$sql = “SELECT vchPassWord FROM tUser WHERE vchUserName = '”.$username."’ AND vchEmail = ‘".$email."’";

$rs = mysql\_query($sql, $conn) or die(mysql\_error());  
$row = mysql\_fetch\_assoc($rs);

if(!$row){  
//The user dont exists  
$success = 0;  
$msg = ‘The user doesn´t exists or the username and e-mail don´t match.’;  
echo ‘&success=’.$success.’&msg=’.$msg.’&’;  
} else {  
//The user exists  
$password = $row[“vchPassWord”];

```
$subject = "Your GrandPrizeCentral.com user information";
$message = "Here is your user information for GrandPrizeCentral.com:

```

";  
$message .= "Username: “.$username.”  
";  
$message .= "Password: “.$password.”  
";  
$message .= "E-mail: “.$email.”

";  
$message .= "Log on to: [http://www.this](http://www.this) [company.com](http://company.com)  
";  
$footer = “From: [GrandPrizeCentral.com](http://GrandPrizeCentral.com)”;

```
$formsent = mail($email, $subject, $message, $footer);

if($formsent == 1) {
    $msg = "Thank you, your password has been sent to ".$email;
} else {
    $success = 0;
    $msg = "We are sorry, but your password could not be sent to ".$email;
}
echo '&success='.$success.'&msg='.$msg.'&';

```

}

mysql\_close($conn);

## ?\>

What could be the problem of it submitting the password? Everything else works fine…user name and email…and it sends the email after submittion.

Any advise would be fantastic.

Thanks

M.
