PDA

View Full Version : "Illegal Operation" with Flash and PHP in FireFox


krs1ars
02-19-2005, 04:26 PM
Hey all, I'd appreciate any help you can give with this.

I'm running a basic personal site that uses flash, and some basic php scripts to track users actions, and records them to a server text file. The scripts had been up for about a week, and then versions of Mozilla Firefox started having problems with it. The windows version gives an error "This Plug in performed an illegal operation. It is strongly advised that you restart navigator." While the linux version just closes the page.

However, there's no problem with IE or any other browers that I know of.

Here's the actionscript code to send variables to php, in this case, to let it know that the page is loaded:

<Frame Actions in First Frame>


date = new Date();
time = (date.getMonth()+1)+"-"+date.getDate()+"-"+date.getFullYear()+" "+date.getHours()+":"+date.getMinutes()+":"+date.getSeconds();
lvOut = new LoadVars();
lvOut.text = time;
lvOut.act = "Page Loaded.";
lvOut.spaces = "...";
lvOut.sendAndLoad("/control.php", lvOut, "POST");
this.stop();


<Here is the receiving PHP Script>
<?php
$inputTime = $_POST['text'];
$inputAct = $_POST['act'];
$inputSpaces = $_POST['spaces'];
$inputNewline = " \n ";

$fp = fopen("stats.txt", "at" );
fwrite($fp, $_SERVER['REMOTE_ADDR']);
fwrite($fp, $inputSpaces);
fwrite($fp, $inputTime);
fwrite($fp, $inputSpaces);
fwrite($fp, $inputAct);
fwrite($fp, $inputNewline);
fclose($fp);
echo " ";
exit;

?>


An interesting note though. When the page is loaded with Firefox, it does run the script, and "Page Loaded..." is recorded in the text file, but thereafter, the flash application stops functioning and the text file has no more entries.
For the curious, see the error in action... http://krsulich.mit.edu
Thanks a bunch.

krs1ars
02-19-2005, 09:33 PM
problem solved