Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

php?...old, davidbyng, wang?..some help..

Status
Not open for further replies.

coldfused

Technical User
Jan 27, 2001
2,442
US
ok guys this is what i want..last night i found a script that allows you to send variables through flash using asp to write to a text file on the server..mc1 is text file that is returned from the server using load variables..mc 2 is hidden untill password in mc1 is submitted and is correct..thus setting mc1 visible=false..mc2visible=true..mc two has a input txt box and a button that passes the variable Text through the asp and writes to the Text.txt file on the server..when you hit the button to submit your txt, mc2 visible=false, mc1 visible=true, but now shows up with your changes that Textwrite.asp made and returns the variable Text.txt in flash..you guys understand?..sorry if i'm confusing but hey, it's me, confused...anyways i got all this working and all is well, except one thing..the server that i have the site running on is a linux server not windows..screwed................after all that..i know i know, i should have checked...

i need a php script that writes to a text file through flash and returns the variable Text.txt in flash with changes made..why you ask..a news page that i won't the owner of the site to be able to update on his own through flash...he will be making daily changes..

is this possible with php?..or any other ideas?.
logo.gif


carlsatterwhite@orlandomediasolutions.com
 
I don't know anything about PHP, but here is a simple hit count script that writes to a text file, so you could probably modify to write the flash stuff :

Regards

Big Dave

davidbyng@hotmail.com


** If I am wrong I am sorry, but i'm only trying to help!! **
 
thanks dave, but not quite what i was looking for..will try in the php forum..
logo.gif


carlsatterwhite@orlandomediasolutions.com
 
This really shouldn't be too hard in PHP.

My Assumption is you're using POST or GET via an FSCommand (or another internal flash mechanism that's not coming to mind, but still uses GET or POST).

If so, the PHP page will need the name of the variable containing the information. To write to a file in php (if the variable/form object containing the info is TextSent):

<?php
if(isSet($TextSent) ){
$fileName = &quot;yourfilename&quot;;
$fp = fopen($fileName, &quot;w&quot;) or die(&quot;The server won't let me! Waaaahhh!&quot;) ;
$fout = fwrite($fp, $TextSent) ;
fclose($fp) ;
}
?>

As for reading, it's almost the same thing:

<?php

$fp = fopen(&quot;yourfilename&quot;, &quot;r&quot;) or die(&quot;The server won't let me! Waaaahhh!&quot;) ;
$fstring = fread($fp, filesize($fileName)) ;
fclose($fp) ;
// the rest of your code to display the here....
// my example would be (so that it's in flash's load variable format....
print &quot;variableName=&quot; . $fstring ;
?>

php is pretty easy to work with, specially if you've used ASP. php.net has their function and language documentation online at php.net. Oh, and my code is pretty rough... just the basic crud to introduce ya to it, since I'm learning also...

Hope I helped some... or at least didn't hurt ; ) The Jhereg
=~=~=~=~=~=~=~=~=~=~
I never lie.
I'm building a reputation for honesty so I can blow it when something big comes along... This ain't it.
 
Wouldn't it be easier, for your owner, to just edit a text file (with Wordpad or whatever...) and simply upload that new text file to the site, rather than to have to write it through the Flash movie itself?
Then you woudn't have to build all that &quot;moderatorlike&quot; stuff, through PHP!

Regards,
wink4.gif
ldnewbie
 
but that would take all the fun out old..where's you sence of adventure?..

here's the asp jhereg..compare and see if it does the same as i need it to..like i said tha asp works fine..just not on linux..anyways..will your script work?..

<%@ Language=VBScript %>
<%
MyText = Request.Form(&quot;Text&quot;)
Set FileSystem = Server.CreateObject(&quot;Scripting.FileSystemObject&quot;)
set fil = FileSystem.CreateTextFile(&quot;C:\Inetpub\ filename\Text.txt&quot;, 8, 0)'
fil.WriteLine( &quot;Text=&quot; & MyText )
fil.close
%>
logo.gif


carlsatterwhite@orlandomediasolutions.com
 
Sense of adventure! Yeah! On your part... That figures!

Sorry, I can't be of more help in this case!

Regards,
wink4.gif
ldnewbie
 
I'll try to use your variables...

<?php

if(isSet($Text) ){

$fileName = &quot;C:\Inetpub\ filename\Text.txt&quot;;

$fp = fopen($fileName, &quot;w&quot;) or die(&quot;The server won't let me! Waaaahhh!&quot;) ;

$textToWrite = &quot;Text=&quot; . $Text

$fout = fwrite($fp, $textToWrite) ;

fclose($fp) ;
}
?>

I'm away from my dev server right now, or I'd test for you. If you have problems drop me an email and I'll test it out in a coupla hours. The Jhereg
=~=~=~=~=~=~=~=~=~=~
I never lie.
I'm building a reputation for honesty so I can blow it when something big comes along... This ain't it.
 
Umm Duh..... gimejava@swbell.net The Jhereg
=~=~=~=~=~=~=~=~=~=~
I never lie.
I'm building a reputation for honesty so I can blow it when something big comes along... This ain't it.
 
off to school now..will test in when i get in..thanks..i'll let ya know..

logo.gif


carlsatterwhite@orlandomediasolutions.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top