Flash stronger then PHP?

Flash stronger then PHP?

am 10.08.2007 01:54:24 von Vinnie

I have tried several times to make the flash website to communicate
with the PHP script i have on the server, but it does not work. It
should work in this way: when the fields on the forms are all "not
blank" send the mail. The PHP then should be in charge to send the
email to the destination address.

The files are:

PHP (server side):

// get the externl variables
$destMail = $_REQUEST["destMail"];
$senderName = $_REQUEST["senderName"];
$senderMail = $_REQUEST["snderMail"];
$senderSubject = $_REQUEST["senderSubject"];
$senderBody = $_REQUEST["senderBody"];
// add header info
$header = "From: $senderName \br";
$header .= "Replay-To: $senderName \br";
// invio della mail: destinatario, subject, coprpo della mail, header
mail($destMail, $senderSubject, $senderBody, $header);
?>


While the FLASH script is:

fieldsFilled = new Object();
fieldsFilled.onKeyUp = function()
{
if (destMail_txt.text != '' && senderName_txt.text != '' &&
senderMail_txt.text != '' && senderSubject_txt.text != '' &&
senderBody_txt.text != '') {
send_btn.enabled = true;
}
else
{
send_btn.enabled = false;
}
}
Key.addListener(fieldsFilled);
send_btn.enabled = false;
var sendMail_lv:LoadVars = new LoadVars();
send_btn.onRelease = function()
{
sendMail_lv.destMail = destMail_txt.text;
sendMail_lv.senderName = senderName_txt.text;
sendMail_lv.senderMail = senderMail_txt.text;
sendMail_lv.senderSubject = senderSubject_txt.text;
sendMail_lv.senderBody = senderBody_txt.text;
// invio i dati tramite sedandload
sendMail_lv.sendAndLoad("http://PATH TO MY SERVER/sendMail.php",
sendMail_lv, "POST");
}

Thanks a lot.
Vinnie

Re: Flash stronger then PHP?

am 10.08.2007 05:16:32 von jiles

On Aug 9, 7:54 pm, vinnie wrote:
> I have tried several times to make the flash website to communicate
> with the PHP script i have on the server, but it does not work. It
> should work in this way: when the fields on the forms are all "not
> blank" send the mail. The PHP then should be in charge to send the
> email to the destination address.
>
> The files are:
>
> PHP (server side):
>
> > // get the externl variables
> $destMail = $_REQUEST["destMail"];
> $senderName = $_REQUEST["senderName"];
> $senderMail = $_REQUEST["snderMail"];
> $senderSubject = $_REQUEST["senderSubject"];
> $senderBody = $_REQUEST["senderBody"];
> // add header info
> $header = "From: $senderName \br";
> $header .= "Replay-To: $senderName \br";
> // invio della mail: destinatario, subject, coprpo della mail, header
> mail($destMail, $senderSubject, $senderBody, $header);
> ?>
>
> While the FLASH script is:
>
> fieldsFilled = new Object();
> fieldsFilled.onKeyUp = function()
> {
> if (destMail_txt.text != '' && senderName_txt.text != '' &&
> senderMail_txt.text != '' && senderSubject_txt.text != '' &&
> senderBody_txt.text != '') {
> send_btn.enabled = true;
> }
> else
> {
> send_btn.enabled = false;
> }}
>
> Key.addListener(fieldsFilled);
> send_btn.enabled = false;
> var sendMail_lv:LoadVars = new LoadVars();
> send_btn.onRelease = function()
> {
> sendMail_lv.destMail = destMail_txt.text;
> sendMail_lv.senderName = senderName_txt.text;
> sendMail_lv.senderMail = senderMail_txt.text;
> sendMail_lv.senderSubject = senderSubject_txt.text;
> sendMail_lv.senderBody = senderBody_txt.text;
> // invio i dati tramite sedandload
> sendMail_lv.sendAndLoad("http://PATHTO MY SERVER/sendMail.php",
> sendMail_lv, "POST");
> }
>
> Thanks a lot.
> Vinnie

my understanding is that the variables recieved should look like this
$destMail = $_POST["destMail"];
and so on. you can always use the following script to make sure that
your send the varibles to php...
foreach ($_POST as $key=>$value) {
$received .= "$key = $value\r\n";
}

$printout = fopen("variables.txt", "w");
fwrite($printout, $received);
fclose($printout);
?>

That will list the varibles passed to it from flash. Hope this helps.

Re: Flash stronger then PHP?

am 10.08.2007 14:19:21 von Phil

check our AMFPHP, works much smoother and allows your flash to talk
directly to your php objects - READ THE INSTRUCTIONS, its a bid weird
settign it up.

Phil

Re: Flash stronger then PHP?

am 10.08.2007 14:37:29 von Toby A Inkster

vinnie wrote:

> $senderMail = $_REQUEST["snderMail"];

$senderMail = $_REQUEST["senderMail"];

> $header = "From: $senderName \br";
> $header .= "Replay-To: $senderName \br";

$header = "From: $senderName <$senderMail>\r\n";
$header .= "Reply-To: $senderName <$senderMail>\r\n";

Possibly other errors too.

By the way, this script has big security holes and may lead to your server
being blacklisted.

--
Toby A Inkster BSc (Hons) ARCS
[Geek of HTML/SQL/Perl/PHP/Python/Apache/Linux]
[OS: Linux 2.6.12-12mdksmp, up 50 days, 16:12.]

Command Line Interfaces, Again
http://tobyinkster.co.uk/blog/2007/08/02/command-line-again/

Re: Flash stronger then PHP?

am 10.08.2007 15:57:42 von Vinnie

On Aug 10, 8:19 am, Phil wrote:
> check our AMFPHP, works much smoother and allows your flash to talk
> directly to your php objects - READ THE INSTRUCTIONS, its a bid weird
> settign it up.
>
> Phil

Thanks Phil,
What is AMFPHP?