开发者

PHP Adding Slashes to Form Submitted File Path

I have a form that contains a field for a desktop file path. The path is saved then written to 开发者_如何学编程a txt file and then read from that file and the value is put in the form field.

When submitted, slashes are added. In fact whatever slashes are in the path are doubled each time the form is submitted.

Any thoughts around this?


Sounds like you have magic quotes enabled. To check if they're enabled, place the following in your script:

echo 'magic_quotes_gpc=', ini_get('magic_quotes_gpc');
echo 'magic_quotes_runtime=', ini_get('magic_quotes_runtime');

If either of them return 1, then you should disable them. You can also check for this information by running the function phpinfo(); in your script.

Refer to the manual for the best methods of disabling them:

http://www.php.net/manual/en/security.magicquotes.disabling.php


Your server must have Magic Quotes enabled. You can use stripslashes() to get rid of them, but it's possible it will remove all slashes rather than just the ones which were added.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜