-
Editing Pages Using PHP
Argh.... Everytime I try to save a page using this PHP codeing:
PHP Code:
<?php
if( isset( $_POST["code"] ) ){
$f = fopen( "ftp://me:[email protected]/index.php", "w" );
fwrite( $f, $_POST["code"] );
}
?>
<form action="<?=$_SERVER["PHP_SELF"]?>" method="post">
<textarea name="code" rows=20 cols=80><?php readfile( "index.php" ); ?></textarea><br />
<input type="submit" value="Save it, baby!">
</form>
I get this error message:
Warning: fopen("ftp://[email protected]/index.php", "w") - Success in /home/alltom/public_html/flame/editpg.php on line 3
Warning: fwrite(): supplied argument is not a valid File-Handle resource in /home/alltom/public_html/flame/editpg.php on line 4
I originally had fputs, but it didnt work either... :'( please help me...
-
try this
PHP Code:
<?php
if( isset( $_POST["code"] ) ){
$data = $_POST["code"];
$f = fopen( "ftp://me:[email protected]/index.php", "a+" );
fwrite( $f, $data );
}
?>
<form action="<?=$_SERVER["PHP_SELF"]?>" method="post">
<textarea name="code" rows=20 cols=80><?php readfile( "index.php" ); ?></textarea><br />
<input type="submit" value="Save it, baby!">
</form>
-