Reputation: 635
I have this script
<?php
include 'theme.php';
/*ceklogin();*/
css();
if($_POST['wget-send'])
{
$dir=$_POST['dir'];
$link=$_POST['link'];
exec('echo '.$link.' > /tmp/wget-download-link.txt',$out);
exec('wget -P '.$dir.' -b -i /tmp/wget-download-link.txt -o /www/wget.log -c -t 100 -w 10',$out);
echo $out[2];
exit();
}
echo "<br><br><form action=\"".$PHP_SELF."\" method=\"post\">";
echo "Download directory :<br><input type=\"text\" name=\"dir\" size=\"15\" value=\"/mnt/usb/\"/><br>";
echo '<br>Download link :<br>';
echo ("<textarea name=\"link\" rows=\"11\" cols=\"60\"></textarea><br><br>");
echo '<input type="submit" name="wget-send" value="Send" />';
echo "</form></div>";
foot();
echo '
</div>
</body>
</div>
</html>';
?></div>
</html>';
?>
Whenever I type in texts with two lines or more they won't be saved in /tmp/wget-download-link.txt
. The file is always empty but when I only type in a text that consists only one line it's saved there. I'd like my wget-download-link.txt
file to be like this:
http:xxx1
http:xxx2
http:xxx3
Is there any way to do that?
Upvotes: 1
Views: 292
Reputation: 5749
The new line character with the echo command is "\n". Taking the following example:
echo "This is line 1\nThis is line 2" > /tmp/hallo_world.txt
so for you should work
exec('echo "'.$link.'" > /tmp/wget-download-link.txt',$out);
Before doing this you should $link replace \r\n in \n and mask doublequoats in $link content ....
Upvotes: 0