You are here: Re: Form field value containing backslash « PHP Programming Language « IT news, forums, messages
Re: Form field value containing backslash

Posted by semi_evil on 05/23/07 12:15

On May 23, 12:38 pm, Jerry Stuckle <jstuck...@attglobal.net> wrote:
> semi_e...@inbox.com wrote:
> > Hi,
>

> > If either field contains backslashes, they are duplicated when the
> > form reloads.
> > Each successive form submission \ becomes \\, \\\\, \\\\\\\\ etc etc
>
> > Why does this happen and how do I fix the variables to show the
> > original data each time?

> Semi,
>
> You probably have magic_quotes_gpc on in your php.ini file. If so, turn
> it off (it defaults to on); it's not good to have.
>
> If this is your hosting company, the first thing I'd recommend is
> changing hosting companies. There's no good reason (IMHO) why they
> should be running with it on nowadays.
>
> If it is your host and you can't change, to get rid of them, use
> stripslashes(). And if you test to see if magic quotes is on, your code
> will be more transportable, i.e.
>
> if (get_magic_quotes_gpc())
> $body = stripslashes($_POST['body']);
>
> Jerry Stuckle

It is my local setup and php.ini was pretty much as shipped with the
rpm. I've changed magic_quotes_gpc to Off and now it works. But I
checked and noticed my isp also has it enabled so that would have made
no difference this time.

I read the documentation, and I understand what it does and why it's
more of a hindrance than a security aid. I'll work around it using the
test function if required for the time being and inform my ISP they
should switch it off. (Also read PHP6 probably won't even sport a
similar setting.)

Thanks Jerry for your complete and friendly reply, I nearly went
bonkers over this issue.

Cheers,
Semi

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация