Jump to content

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


Demonic

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]
Link to comment
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]
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.