Write to File: Flash to Server Side interaction

Write to File: PHP
<?php //tells the sever this is PHP language
$userName = $_POST['userName']; //get the userName from Flash and store it in a PHP variable
$userEmail = $_POST['userEmail']; //get the userEmail from Flash and store it in a PHP variable
//This lines combines the two variables into one string.
//To concatinate vars in PHP use a period or dot ".", much like Flash uses a plus sign "+".
//This line outputs: First Last<email@yahoo.com>;
$add = $userName . "<" . $userEmail . ">;";
//opens or creates (if it doesn't already exist) our text file (emails.txt)
//for writing (not reading) and places the pointer at the end.
$open = fopen('emails.txt', 'a');
//writes to our specified file our string
$write = fwrite($open, $add);
//sends a response back to flash stating success or failure
//since fwrite returns a value of true or false, $write will be either true or false
if($write)
{
echo "&verify=success&"; //prints to screen &verify=success which flash will read and store as myVars.verify
}
else
{
echo "&verify=fail&"; //prints to screen &verify=fail which flash will read and store as myVars.verify
}
//closes the PHP file.
?>
The next page will have the asp code.


