Jump to content


Photo

So this adds a backslash for some reason anyone know why?


  • Please log in to reply
3 replies to this topic

#1 Demonic

Demonic
  • Members
  • PipPipPip
  • Advanced Member
  • 562 posts

Posted 12 August 2006 - 03:32 PM

<?
$javascript = "javascript.txt";
$open =fopen($javascript,'w');
$script = $_POST[info];


if(isset($post)){
if(is_writable($javascript)){

fwrite($open,$script);
echo "Written Successfully";
}}else{
echo "Couldn't write to File";
echo "<center><form method='post'><textarea name='info'></textarea><br><input type='submit' name='post' value='post'></form></center>";
}
?>


#2 poirot

poirot
  • Members
  • PipPipPip
  • Advanced Member
  • 646 posts
  • LocationAustin, TX

Posted 12 August 2006 - 03:34 PM

Magic Quotes
http://www.php.net/magic_quotes
~ D Kuang

#3 wildteen88

wildteen88
  • Staff Alumni
  • Advanced Member
  • 10,482 posts
  • LocationUK, Bournemouth

Posted 12 August 2006 - 03:38 PM

You might have magic_quotes enabled. Use
set_magic_quotes_runtime(0)
at the top of your script to turn off magic quotes for your script.

Also I'd chnagew your script to this:
<?php
// turn off magic quotes
set_magic_quotes_runtime(0);

if(isset($_POST['info']))
{
    $javascript = "javascript.txt";

    if(is_writable($javascript))
    {
        $open = fopen($javascript, 'w');
        $script = $_POST['info'];

        fwrite($open, $script);
        echo "Written Successfully";
    }
    else
    {
        echo "Couldn't write to File";
    }

}
else
{
    // this is a HEREDOC statement.
    echo <<<HTML
<center>
  <form method="post">
    <textarea name="info"></textarea><br>
    <input type="submit" name="post" value="post">
  </form>
</center>
HTML;
}

?>


#4 Demonic

Demonic
  • Members
  • PipPipPip
  • Advanced Member
  • 562 posts

Posted 12 August 2006 - 03:42 PM

yeah thanks for the tips

ive done stripslashes() works perfectly now.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users