PHP/Flash communication (or lack thereof)
Date: 12/30/05
(PHP Community) Keywords: php
I'm using the sendAndLoad() function from flash and calling a php script called authenticate.php:
$authenticated = 0;
$sender = new LoadVars();
$receiver = new LoadVars();
$sender.sendAndLoad("authenticate.php", $receiver);
if ($receiver.auth == 1) {
$authenticated = 1;
}
trace($receiver.auth);
On the PHP side, here's the script (I tested and know that $_SESSION['user_level'] has already been defined):
= 5) {
$auth = 1;
} else {
$auth = 0;
}
header('Content-type: application/x-www-form-urlencoded');
echo "output=$auth";
?>
When I run flash to see $receiver.auth, I get undefined. Apparently, I'm not setting up the right communication. I'm kinda new to the whole Flash/PHP communication thing. Any suggestions?
Source: http://www.livejournal.com/community/php/385846.html