Jump to content

Newline parsing...?


101kl

Recommended Posts

Here is my current php code:

 

<?php
//--------------------------
// Login details and such
//--------------------------
if(isset($_POST['submit']))
{
$phase1 = fopen($localtempfile, 'w');
$stringData = stripslashes($_POST["area_text"]);
fwrite($phase1, $stringData);
fclose($phase1);
$textarea = fopen($localtempfile,"r");
$conn = ftp_connect($host) or die("Could not connect");
ftp_login($conn,$username,$password);
ftp_pasv($conn,TRUE);
if (ftp_delete($conn,$file)){print'<center><h2>Saved</h2></center>';}else{print'Didnt work yo-';}
ftp_fput($conn,$file,$textarea,FTP_ASCII);
ftp_close($conn);
}
?>
<form method="post" action="<?=( $_SERVER['PHP_SELF'] )?>">
<textarea name="area_text" rows="30" cols="100" ><?=( file_get_contents('ftp://'.$username.':'.$password.'@'.$host.'/'.$file) )?></textarea><br>
<input type="submit" name="submit" value="Save">
</form>

 

My question is, why is it whenever i press the save button, it saves the document but it doubles the lines it prints.

You can see an example here: http://www.pubgamer.org/images/database/editfile.php

Many thanks in advance.

Link to comment
https://forums.phpfreaks.com/topic/199277-newline-parsing/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.