Header Help Please!

I have the following PHP file that is supposed to check mySQL for correct password
then direct to user main page.

Problem: header line does not seem to be working!!! —> i know that the rest of my php code is working because I swapped the header line with a print command that displays the correct string in my flash movie.

Please let me know the best way to redirect the browser to a particular page once password authentication is verified!

thanks so much in advance!

The code that i used:

<?
$user="USER_NAME";
$host="MY_HOST";
$password="MY_PASSWORD";
$database = "MYDATA_BASE";
$connection = mysql_connect($host,$user,$password);     
$db = mysql_select_db($database,$connection);       
$db = mysql_select_db($database,$connection);
      
         
$pnts= ($amount*.02*1000*.6)+786;

$query = "SELECT * FROM passwords WHERE user='$puser' AND pass='$ppassword'";

$result= mysql_query($query);

$nrows=mysql_num_rows($result);

if ($nrows >= 1) {
header("Location: http://this_is_an_absolute_address.com/code/PROF_PROFILE_TEST.php");
exit;
}
else 
{
Print "_root.status=SORRY!  User and password does not exist on our database!";
}
?>

if you run the php file by itself I’m sure you’ll see that it redirects properly. The reason flash isn’t picking up on it is another store altogether. I’m guessing you probably are using the deprecated LoadVars …

hmmm…because when i use the flash file i do in fact see that the error message in the flash file returns the correct string depending if the password is correct or not (success statement or error statement)

this is what happpens when i swap the header line with a print command.

but when i put the header line in - it doesnt do anything.

i am using loadVariablesNum.
any suggestions?

Because the flash is making the request, the headers will have already been sent to the browser (when the main page you’re on loads), therefore the request is not sent. You should just send a “success” string back to flash and then use getURL to do the redirect.

I’m fairly sure that Flash does not follow header-based redirects. Instead you will need Flash to open a new request to whatever URL it gets. That would be the simplest way to do it that I know of.