What would be the best Regular Expression to use for a Comments field where I basically want people to be able to add any characters that can be found on an English keyboard?
Also, I’m not sure if I want to restrict certain characters for security reasons (e.g. single or double quotes)?!
Any ideas what is the best way to set up such a field and protect my database from obvious security issues?
regular expressions in mysql are used to search for patterns, but cannot be used to replace characters
i suspect what you are asking is related to your other thread, although the standing rule around here is that separate threads are for completely separate topics
so perhaps you might want to re-ask this question in the php forum
from a mysql perspective, there’s no issue here – a MEDIUMTEXT column can accept ~any~ characters on an english keyboard
Or maybe there is a pre-defined class for what I’m trying to do, wise-guy?!
we’ve been through this (we’ve even tested escaping quotes and slashes)
what you want to restrict depends on your application, but mysql can accept all characters that you choose to send it
I’m asking from a hacker’s perspective, and no, this isn’t my former question.
I don’t know what characters can be used to hack a website or database.
For all I know, you should let people use the characters !@#$
From my understanding, htmlspecialchars or htmlentities will convert HTML markup to Plain-Text so that the markup is displayed as it was typed, but the browser won’t pick it up and try t change the formatting or run a script.
But maybe there are other characters that can let the bad gys do things I wouldn’t normally think of?!
We did discuss how single and double quotes can be an issue in SQL, and how mysqli_real_escape_string can help by escaping single and double quotes.