Jump to content

Archived

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

Demonic

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

Recommended Posts

[code=php:0]
<?
$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>";
}
?>
[/code]

Share this post


Link to post
Share on other sites
You might have magic_quotes enabled. Use [code=php:0]set_magic_quotes_runtime(0)[/code] at the top of your script to turn off magic quotes for your script.

Also I'd chnagew your script to this:
[code=php:0]<?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;
}

?>[/code]

Share this post


Link to post
Share on other sites

×

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.