PDA

View Full Version : Exporting to a textfile (or any other if better)



Riddler?
December 26th, 2003, 01:52 AM
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

Riddler?
December 26th, 2003, 02:27 PM
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:
loadVariablesNum ("save.php", 0, "POST");

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 :)

reverendflash
December 26th, 2003, 02:29 PM
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.

Revhttp://aulman.com/rev.gif

Riddler?
December 26th, 2003, 02:35 PM
hehe i know... i was just trying to help out and save some folks some time :-D happy holidays! (the birth of Jesus is a world wide holiday ;))

reverendflash
December 26th, 2003, 02:37 PM
Originally posted by Riddler?
hehe i know... i was just trying to help out and save some folks some time :-D happy holidays! (the birth of Jesus is a world wide holiday ;))

really?

I hadn't noticed...

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

Revhttp://aulman.com/rev.gif

Riddler?
December 26th, 2003, 02:39 PM
haha i have no idea what your problem is, but im sorry if i offended you .... lol that really caught me off guard...

reverendflash
December 26th, 2003, 02:44 PM
(the birth of Jesus is a world wide holiday )

wasn't a smartass comment? you were the one who put the ;) 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

Revhttp://aulman.com/rev.gif

Riddler?
December 26th, 2003, 02:49 PM
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

reverendflash
December 26th, 2003, 03:16 PM
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...

Revhttp://aulman.com/rev.gif

claudio
December 26th, 2003, 03:20 PM
Adding flash footers
http://www.kirupaforum.com/forums/showthread.php?s=&threadid=12

reverendflash
December 26th, 2003, 03:21 PM
thanks claudio...

Revhttp://aulman.com/rev.gif

claudio
December 26th, 2003, 03:22 PM
No problem Rev :)

Riddler?
December 26th, 2003, 03:23 PM
w00t thanx guys!! now for the real problem... hehe

reverendflash
December 26th, 2003, 03:43 PM
Vash is the php guy... this may be better in the server side forum.

Revhttp://aulman.com/rev.gif

Riddler?
December 26th, 2003, 04:21 PM
I had thought so too after i posted here.. is there anyway it can be moved so i dont have to double post?

reverendflash
December 26th, 2003, 04:25 PM
consider it moved...

Revhttp://aulman.com/rev.gif

norie
December 26th, 2003, 05:46 PM
Originally posted by reverendflash
consider it moved...

Revhttp://aulman.com/rev.gif

this thread isn't the only thing moved :)


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

Riddler?
December 26th, 2003, 05:56 PM
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!!!!

Riddler?
December 27th, 2003, 01:04 AM
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

norie
December 27th, 2003, 03:30 AM
<?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";
}
?>

Riddler?
December 27th, 2003, 11:00 PM
haha man you rawk :) thanx again soo much! :D