-
Originally Posted by McUsher
I give up...
there where u added the bloody new Date().getTime() thingy i provided ...
This... works fine! That was a big help! Thanks
loadVariablesNum ("savevar.txt?version="+new Date().getTime(), 0);
-
Originally Posted by MyFriendIsATaco
PHP Code:
<?php
$MyXCode = $_POST['mycode'];
$toSave ="&mycode=$MyXCode";
$fp = fopen("savevar.txt", "w+");
if(fwrite($fp, $toSave))
echo "&writing=Ok&";
else
echo "&writing=Error&";
fclose($fp);
?>
you need the '&' in front of what you are echoing back to flash...See if that works for ya!
Why would the "&" in front of the echo effect the "\" being saved in the text file?
-
The echo only tells me if the file saved or failed. That already worked even without the &
I can save and open the file fine, thanks to McUsher.
My issue now is thate when I save (through PHP) if I use ' or " it inserts a "\" into the file.
So when I open the file... the "\" load in with the file. But I have another routine that displays the basic html (from 1 textbox) into another dynamic html text box. But if there are "\" in the wrong place it won't display the html text in my preview html dynmaic text box.
See flash app here
Thanks
-
Flash Gordon
Hmm.. it gets blood escaped i don't know by what..
Try doing escape(mycode) before sending,
then when putting them into the textfields do:
textField.text = unescape(mycode);
and
htmlTextField.htmlText = unescape(mycode);
It is really hard, debugging without even knowing the sourcecode..
-
There is a link on the movie of the source code
It's flash 5 though
-
Flash Gordon
Ok..
The cause: While posting a String, quotes and stuff will get escaped by flash,
so " will get \" and \ will get \\
You don't want this.
so..
Code:
on (release) {
// getURL ("http://www.ourwebzone.com/savevar.php", "", "POST");
_root.saveMyCode = escape(mycode);
loadVariablesNum ("savevar.php", 0, "POST");
}
PHP Code:
$MyXCode = $_POST['saveMyCode '];
$toSave ="&mySavedcode=$MyXCode";
then in ShowPreview:
Code:
// remove: _root.preview = _root.mycode;
_root.preview = unescape(_root.mySavedcode);
_root.mycode = unescape(_root.mySavedcode);
I am not sure, if this will work, as you have currently no
control over the moment, the vars are loaded, i highly
suggest you to try the LoadVars object..
And btw, there are some WYSIWYG Editors in the
movies section of fk..
-
Thanks... I will see what I can do.
Thanks
-
-
Flash Gordon
You owe me: pls try more to understand, what you are doing
And learn about the LoadVars. As on a slow connection
it currently woulnd't work, as the ShowPreview just waits
for some frames, if the txt file isn't loaded then.. nothing would
display.
My code was the most simple way to get your thing working,
to get it bugfree there have some things to be done.
-
Thanks...
If you take a look at the Flash Wiki I am trying to make you will see that I am having trouble with the toolbar buttons on the Wiki Editor.
I am using the FlashDB.pl (perl) that FlashDB.com offers. It is a great script. But, it will save every text box that has a variable. Which I don't want (see this thread about issue)
The problem with that system is the only way that I knew how to get around the saving issue with FlashDB, was to load two seperate SWF's.
But somehow, the loading of the text file on the editor would knock out my functions so that the buttons would'nt work. And I gave it plenty of time to load. So I removed the load of the text file to double check and that is what it was.
So I decide to try and make my own PHP (which I am new at) so that I could only save the variable that I wanted and put my WYSIWYG editor and preview page in one swf.
So now that you helped me... I can try to fix my Flash Wiki.
I understand the LoadVariables pretty good... it just I couldn't understand PHP and why the ' and '' were not working.
I noticed that the PHP now saves the fle in a different format... almost linke binary (?), what has happend and why?
Thanks
Your a Life Saver ( )
-
The backslashes are added automathically from php when it's running in safe mode (or the magic quotes = on) to all post, get etc variables .. this is done to prevent sql injecting / a hacker attack /.
To solve:
$MyXCode = stripslashes($_POST['mycode']);
while (2+2 == 4) {
drink ("bourbon");
}
gotoAndStop("bed");
-
McUsher (or anyone).... one more question
This is the PHP I use to write the file (based on stripping the slashes that set up in Flash)
Code:
// SAVE TEXT FILE IN PHP
<?php
$MyXCode = $_POST['saveMyCode'];
$toSave ="&mySavedcode=$MyXCode";
$fp = fopen("savevar.txt", "w+");
if(fwrite($fp, $toSave))
echo "&writing=Ok&";
else
echo "&writing=Error&";
fclose($fp);
?>
Now, can I trouble somebody for the equivalent code for READING the PHP?
I do need one thing added.... that is an echo to flag when read is done.
Maybe something like...
echo "state = "Done";
Code:
// READ TEXT FILE
<?php
Read File Code ?????????
?>
Any help would be great
Thanks
-
PHP Code:
<?php
$filename="savevar.txt";
$fp=fopen("$filename","r");
$content=fread($fp,filesize("$filename"));
fclose($fp);
$MyReadVar= $content . "&read=done&";
print $MyReadVar;
?>
while (2+2 == 4) {
drink ("bourbon");
}
gotoAndStop("bed");
-
Flash Gordon
He just C&Ps code without thinking about it.. i gave up..
I think you did learn about the LoadVars ?! Because the LoadVars
have an event, when everything is loaded..
-
Originally Posted by McUsher
I think you did learn about the LoadVars ?!
I seriously doubt that ... come on ... 34 post for something that simple ... !
while (2+2 == 4) {
drink ("bourbon");
}
gotoAndStop("bed");
-
Hey.... what is the deal here.
I already said... I understand the loadvar of flash. It's the PHP I am having trouble with.
I didn't just cut and paste... if you look back through the post I posted some PHP code that I tried to put together.
Sorry I put you all out!
I won't ask you again. After all I wouln't of come here If I knew everything like you do.
-
Come on man, dont get touchy No one means harm ... after all that's what the forums are all about! To ask and get help .. but also to learn!
Now i dont know why did you need that "read" flag but I guess you wouldnt need it if you used the LoadVars class.
As for the php code. if you open the manual you can find that piece of code for less than a minute. I mean, it's the most simpliest one! That goes for the backslashes too... If you show that you tried everything possible and gave your best to make it work before you give up and ask for help, everyone will gladly help.
Now I hope I was helpful, and of course do not hesitate to ask whenever you are stuck!
while (2+2 == 4) {
drink ("bourbon");
}
gotoAndStop("bed");
-
Originally Posted by Smilev
Come on man, dont get touchy No one means harm ... after all that's what the forums are all about! To ask and get help .. but also to learn!
Now i dont know why did you need that "read" flag but I guess you wouldnt need it if you used the LoadVars class.
As for the php code. if you open the manual you can find that piece of code for less than a minute. I mean, it's the most simpliest one! That goes for the backslashes too... If you show that you tried everything possible and gave your best to make it work before you give up and ask for help, everyone will gladly help.
Now I hope I was helpful, and of course do not hesitate to ask whenever you are stuck!
the read flag is used to check when the file is done so I can continue on and play the next frames... plus display to the user that file is loading incase the file is slow loading.
What manual? I coudln't find anything on PHP in Flash 5 help file. (still looking though)
I do use my help file.
-
Of course I meant the php manual Here php manual
the read flag is used to check when the file is done so I can continue on and play the next frames... plus display to the user that file is loading incase the file is slow loading.
Exactly .... you dont need a flag to do that with LoadVars object. You use its events
while (2+2 == 4) {
drink ("bourbon");
}
gotoAndStop("bed");
-
Flash Gordon
Pls remember that enlish is a foreign language to me..
I sometimes just can't find the right words.
I don't wanna flame, nor be rude in any way. You are just giving me, and
i think Smilev, a hard time helping you.
You claim to have understood the loadvars but try to set a variable in php
to let flash know everything was loaded, which got us caught between the
devil and the big blue sea.
1) I just say forget about that read-confirmation in php, and load the savedtext directly.
Use the LoadVars.onLoad event to determine when loading of the file is done.
2) You already used escape(mycode) to get rid of any slashes. No need for stripslashes in flash anymore.. Please read the help about escape(), that'll tell you why your saved file will look a bit "binary".
[edit]
u 2 type too fast..
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|