Thread: Magic Quotes

    #1
  1. Full Access
    Devshed Regular (2000 - 2499 posts)

    Join Date
    Jun 2000
    Location
    London, UK
    Posts
    2,019
    Rep Power
    16
    I am using this script to edit an HTML file on a web server:

    <BLOCKQUOTE><font size="1" face="Verdana,Arial,Helvetica">code:</font><HR><pre>

    <html>
    <head>
    <title>Editing <? print "$file"; ?></title>
    </head>

    <body>

    <form method=POST action="save_file.php3">

    <b><u><? print "$file"; ?></u></b><br><br>

    <textarea name="data" rows=10 cols=70>
    <?
    if (file_exists("$file"))
    {readfile("$file");}
    ?>
    </textarea><br><br>

    <input type="hidden" name="file" value="<? print "$file"; ?>">

    <input type="submit" name="submit" value="Save Changes">

    </form>

    </body></html>

    -----save_file.php3-----

    <?

    $f = fopen("$file", "w");

    fputs($f, $data);

    fclose($f);

    print "File $file has been amended!";

    ?>

    [/code]

    But the problem I am having is that when there are single quotes in the file, they get "escaped" by a backslash. My guess is that I need to enable Magic Quotes at runtime, but how do I do that on my win32 machine in the PHP script? If it's not magic quotes that I need to change then can someone tell me what it is that I need to change. Thanks.

    ------------------
    ------------------------
    Alex
    (http://www.alex-greg.co.uk)
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2000
    Posts
    32
    Rep Power
    14
    You need to disable magic quotes gpc from your php.ini file, or failing that just use $file=stripslashes($file).

Similar Threads

  1. problem with magic quotes
    By summercom in forum PHP Development
    Replies: 2
    Last Post: June 8th, 2003, 10:08 PM
  2. problem with magic quotes removing wanted \\
    By Lucent in forum PHP Development
    Replies: 4
    Last Post: May 22nd, 2003, 04:28 PM
  3. PHP3 magic quotes gpc/runtime detect/emulate blah blah
    By JeffCT in forum PHP Development
    Replies: 7
    Last Post: September 29th, 2001, 07:39 PM
  4. Help storing uploaded files in DB with magic quotes!
    By MaRaNzA in forum PHP Development
    Replies: 0
    Last Post: August 19th, 2001, 04:20 PM
  5. htaccess and magic quotes
    By bob mallett in forum PHP Development
    Replies: 2
    Last Post: April 7th, 2001, 07:22 AM

IMN logo majestic logo threadwatch logo seochat tools logo