Page 1 of 1

Single quote error in comments

PostPosted: 01. October 2016 15:52
by alebulo
HI, I want to make an inquiry ... can configure the Xampp, specifically the version 1.8.2, to directly take the single quotes and all symbols "forbidden" without changing the .php? because I have a loading site in Italian notes and comments carry the load simple no tittle and gives me error .....

Re: Single quote error in comments

PostPosted: 01. October 2016 19:35
by Nobbie
Sorry, but your error "description" is chaotic and i dont understand a single word.

Re: Single quote error in comments

PostPosted: 01. October 2016 20:04
by Altrea
Hi,

I don't have any idea if i understand your description.
Don't output any user generated input without escaping => http://php.net/manual/en/function.htmlspecialchars.php

best wishes,
Altrea

Re: Single quote error in comments

PostPosted: 02. October 2016 02:38
by alebulo
Sorry for that, use Google traslator.... Can i configurate the xampp, specially the 1.8.2 version for take it simple quotes without changing .php files? when i make an entry in a imput form, like "Dell'Studente " don´t work for a quote. Form is for upload Student comments for a school .

Re: Single quote error in comments

PostPosted: 02. October 2016 10:58
by Altrea
Take a look at my reply. The problem is not the input, the problem is the output. Use php's htmlspecialchars

Re: Single quote error in comments

PostPosted: 02. October 2016 11:20
by Nobbie
alebulo wrote:when i make an entry in a imput form, like "Dell'Studente " don´t work for a quote.


"Dont work" is still not a proper description. Single quotes in forms of course "work" and are no problem for PHP, but maybe you have an error in your PHP Script, that the input is used in a query or in another form (or similar) and your script does not handle (i.e. escape) the quotes correctly. Anyway, this is NOT a PHP issue, it is a programming issue. Everything depends on your PHP script and the data, but not on PHP itself.

Altrea already gave you a hint to a PHP function, which may be usefull in certain cases (but we cannot determine if this already fixes your problem), for MySQL Data Access there is also a very usefull function (or method) mysqli_real_escape_string() (see the documentation on http://php.net/manual/en/mysqli.real-escape-string.php) and finally there is a function addslashes() which escapes quote characters in strings: http://php.net/manual/en/function.addslashes.php

It depends on your script and your data flow, which function might be helpfull for you.

The old function magic_quotes_runtime() has been deprecated since PHP 5.3 and removed since PHP 7. If your PHP version is older than 5.3, you might try to use the runtime option magic_quotes_gpc (set it to "On" or 1 in php.ini), but keep in mind, that this feature will disappear when you are doing an upgrade.

Re: Single quote error in comments

PostPosted: 02. October 2016 15:27
by alebulo
Ok, thank you!!