Exporting to a textfile (or any other if better)

Ok I’m trying to make a small thing on a website that will allow the user to update the news themselves… after reading up on it i found that to export a textfile in this way I would have to have a serverside script to execute it for me (PHP in my case)… I did it, but it isnt working… what am i doing wrong? plz help

SOURCES:

http://jayhayes.no-ip.com/Jay/crap/exporter.zip

im kind of confused why i havent gotten any help :puzzle:

so i thought maybe you guys didnt want to take the time to download the sources… so here they are…

I have a button in my movie that contains this:
[AS]loadVariablesNum (“save.php”, 0, “POST”);[/AS]

and then a php file that contains this:


<? php
$test = $_POST["test"];
$filname = './test.txt';
$fp = fopen($filname, 'w');
fputs($fp, "$test");
fclose($fp);
?>

im not extremely familiar w/ php so idk what the prob is… help plz :slight_smile:

it is a holiday, in the US anyway, most people are with family and away from their computers.

patience is a virtue.

it isn’t personal, the right person will answer when they get a chance.

Rev

hehe i know… i was just trying to help out and save some folks some time :smiley: happy holidays! (the birth of Jesus is a world wide holiday ;))

*Originally posted by Riddler? *
**hehe i know… i was just trying to help out and save some folks some time :smiley: happy holidays! (the birth of Jesus is a world wide holiday ;)) **

[s] really?

I hadn’t noticed… [/s]

You were the one wondering, outloud, why your thread hadn’t been answered, so don’t get snippy to me…

Rev

haha i have no idea what your problem is, but im sorry if i offended you … lol that really caught me off guard…

(the birth of Jesus is a world wide holiday )

wasn’t a smartass comment? you were the one who put the :wink: wink guy next to your obvious statement.

You are not well known here, so how am I supposed to know your intent? You sounded impatient, so I made an attempt to calm your eagerness. You then make a snippy remark with a wink, and now you say it caught you off guard?

BTW - if you want to use a flash footer, it needs to be 300 wide x 60 tall maximum. Just an FYI

Rev

thanx man for the help… something must be wrong w/ my sytax because the sig still isnt working

and im sorry, i wasnt being sarcastic or smart toward you… sorry you took it that way. i was just being happy, not a butt

cool.

I think it is the swf=" thing…

(I’m not really a programmer, more of an animater from way back)

there is a sticky somewhere about this…

Rev

Adding flash footers
http://www.kirupaforum.com/forums/showthread.php?s=&threadid=12

thanks claudio…

Rev

No problem Rev :slight_smile:

w00t thanx guys!! now for the real problem… hehe

Vash is the php guy… this may be better in the server side forum.

Rev

I had thought so too after i posted here… is there anyway it can be moved so i dont have to double post?

consider it moved…

Rev

*Originally posted by reverendflash *
**consider it moved…

Rev **

this thread isn’t the only thing moved :slight_smile:

http://kirupa.rastardesigns.com/exporter.zip

Norie… I LOVE YOU :D!!! Thank you sooo much… and also big props for explaining that code too!!! thank you! i will try to remember to show you guys my finished product when im done :D!!!

hey thanx for the awesome help, but after I got to messing w/ it I hit another small problem that my lack on PHP knowledged kept me from fixing… here is my updated file i made to suit me:

<?php
$filename = 'news.txt';
$tag = 'news=';
$somecontent = $_POST['news'];

// Let's make sure the file exists and is writable first.
if (is_writable($filename)) {


    if (!$handle = fopen($filename, 'w')) {
         print "Cannot open file ($filename)";
         exit;
    }

    // Write $somecontent to our opened file.
    if (!fwrite($handle, $tag)) {
       print "Cannot write to file ($filename)";
        exit;
    }
    
//    print "news=$tag";
    
    fclose($handle);

    if (!$handle = fopen($filename, 'a')) {
         print "Cannot open file ($filename)";
         exit;
    }

    // Write $somecontent to our opened file.
    if (!fwrite($handle, $somecontent)) {
       print "Cannot write to file ($filename)";
        exit;

    print "news=$somecontent";
    
    fclose($handle);
    
}
    
    print "news=$somecontent";
					
} else {
    print "news=The file $filename is not writable";
}
?>

my prob is that if i enter something into my text box that has an apostrophe of quotation PHP automatically adds the backslash for the obvious reasons… but this messes me up when I try to use my HTML tags or just apostrophe’s in my lil example thing at www.jayhayes.no-ip.com/Jay/crap/thingy.html thanx again guys

<?php
//return var 'news'
$filename = 'news.txt';
$somecontent = stripslashes($_POST['news']);

// Let's make sure the file exists and is writable first.
if (is_writable($filename)) {


    if (!$handle = fopen($filename, 'w')) {
         print "news=Cannot open file ($filename)";
         exit;
    }

    // Write $somecontent to our opened file.
    if (!fwrite($handle, $tag)) {
       print "news=Cannot write to file ($filename)";
        exit;
    }
    
//    print "news=$tag";
    
    fclose($handle);

    if (!$handle = fopen($filename, 'a')) {
         print "news=Cannot open file ($filename)";
         exit;
    }

    // Write $somecontent to our opened file.
    if (!fwrite($handle, $somecontent)) {
       print "Cannot write to file ($filename)";
        exit;

    print "news=$somecontent";
    
    fclose($handle);
    
}
    
    print "news=$somecontent";
                    
} else {
    print "news=The file $filename is not writable";
}
?>