-
backup code flat file
I need the small bit of code to backup some data. I have like 10 text areas that I want backed up to a flat file based on date.
So basically I will have a button in my script that will say "backup data"
and all my textarea's will be backed up according to todays date, when the button is pressed.
for example, 07_13_04-backup
Any idea on how to do this?
-
Well, #1, you have realize that the backups will only be on the server. PHP can only write to the server's HD.
#2, check this out. You will obviously set your text area page up to be a form and on a submit, you process it using fwrite.
-
1 Attachment(s)
I know. ITs going to be written to the servers HD.
Heres a zip file of my script. admin.php is the file that would probably have the backup code in it. Maybe check it out? Easy script to understand.
Thanks for any code/help u can give!
-
1) Turn off global variables if you are using them.
2) Everything will be passed in the POST array (which you have chosen) and can be accessed like this:
PHP Code:
$POST_['sent1']
And then we have to talk about this:
PHP Code:
$a = fopen("conf.php", "w") or die ("Dosya aÝlamadÝ!");
fputs($a, "<?php
\$tablewidth= \"$tablewidth\";
\$tableheight= \"$tableheight\";
\$bgcolor = \"$bgcolor\";
\$border = \"$border\";
\$scrollspeed = \"$scrollspeed\";
\$fontsize = \"$fontsize\";
\$fontstyle = \"$fontstyle\";
\$fontcolor = \"$fontcolor\";
\$bold = \"$bold\";
\$lineheight = \"$lineheight\";
\$sent1 = \"$sent1\";
\$sent2 = \"$sent2\";
\$sent3 = \"$sent3\";
\$sent4 = \"$sent4\";
\$sent5 = \"$sent5\";
\$sent6 = \"$sent6\";
\$sent7 = \"$sent7\";
\$sent8 = \"$sent8\";
\$sent9 = \"$sent9\";
\$sent10 = \"$sent10\";
\$sent11 = \"$sent11\";
\$sent12 = \"$sent12\";
\$sent13 = \"$sent13\";
\$sent14 = \"$sent14\";
?>\n");
fclose($a);
print ("$success");
?>
1) Why do you open/close a php block inside of a php block?
2) What are those slashes for? (the ones at the beginning of all the lines)
Are you getting any output?
edit: I guess you can't color code in a php block.