# Problems with Flash/PHP 'Change Password' script

**URL:** <https://forum.kirupa.com/t/problems-with-flash-php-change-password-script/194207>\
**Category:** programming\
**Created:** [July 21, 2006, 9:57am UTC](https://forum.kirupa.com/t/problems-with-flash-php-change-password-script/194207 "2006-07-21T09:57:52Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Orpheus7](https://avatars.discourse-cdn.com/v4/letter/o/aca169/32.png) [@Orpheus7](https://forum.kirupa.com/u/Orpheus7)\
**Post date:** [July 21, 2006, 9:57am UTC](https://forum.kirupa.com/t/problems-with-flash-php-change-password-script/194207/1 "2006-07-21T09:57:52Z")

</div>

Hi there,

I am a newbie, and I have been really struggling with Flash AS/PHP scripts that allows a logged in user to change their password. I use an almost identical system for registration and login, and without any problem.  
The problem is as follows; when the user enters their new password into the Flash input field (called ‘pass’) and presses the ‘submit’ button, I am not sure if the variable gets passed to the PHP script. In any case, the only feedback I get from the PHP script is that it could not connect with the database.  
Does anyone out there in PHP-land have any idea what the problem might be?

Here is the code, for reference sake (Please excuse its crudeness, but I am still learning to use Flash and PHP);

Actionscript (Flash 8) on the submit button;

```auto
on (release, keyPress "<Enter>") {
    if (pass != "") {
        status = "Initiating Process - Stand By";

        loadVariablesNum("*(my url)*/members/new_pass.php", 0, "POST");
        gotoAndPlay(3);
    }
}

```

The input field variable is called ‘pass’ and there is a dynamic text field with the variable ‘status’.

The PHP code for the new\_pass.php file is as follows;

```php
<?php
ob_start();
session_start();

include('(my url)/templates/mysql_connect.php');

$pass = $_POST["pass"];

if ($pass){

       mysql_connect($DBhost,$DBuser,$DBpass)or die("Could not connect to database. MySQL said: ".mysql_error());
           mysql_select_db("$DBName")or die("Could not select the database. MySQL said: ".mysql_error());
              $query = "UPDATE members SET userpassword=$pass WHERE username={$_SESSION['username']}";
              $result = mysql_query($query)or die("The query failed. MySQL said: ".mysql_error());
                    if (mysql_affected_rows() == 1) {
                           print "_root.status=Password changed&_root.checklog=1";
                           exit();

            } else {

            print "_root.status=Password could not be updated&_root.checklog=2";

            }

      }

else {

print "_root.status=Problem connecting to database&_root.checklog=3";

}

ob_end_flush();
?>

```

Finally, the mysql\_connect.php file is as follows;

```php
<?php

$DBhost = "www.(my url).com";
$DBuser = "orpheus7";
$DBpass = "peter_pan";
$DBName = "game_db";

?>

```

I have altered the passwords, host and urls for security reasons.

Any help with this would be most appreciated. Thanks for your time.
