Forum Moderators: coopster
I want to allow ONLY alpha chars (right now the search is not set up for boolean -- but eventually will be) spaces and a plus sign.
How would I go about this?-- I'm assuming it's pretty simple, but just haven't seen something I could use (that I completely understand-- I don't like employing code I don't fully understand!).
If they enter other stuff, I want to send them a page with a msg. that they screwed up, otherwise, I'll go ahead and do the search.
Thanks much.
Clair
use regex for this e.g [a-zA-Z0-9] and no other symbol...
if you are afraid of query breaking then you can use mysql_real_escape_string() if your magic quotes are off...
but remember if you have programming related blog then you could use these symbols in your articles and this will prevent users to search for those articles...
Right now the system only works with one search term (boolean not implemented yet -- so I don't know if I even need to let them use the plus sign.
Which means right now, I ONLY want alpha characters accepted -- anything else and they are out on their ears.
I think I don't know the term(s) to look for in PHP books to find the code that will look at what the form has sent to the PHP and check it for only alpha chars.
If you could tell me the function I need, I would much appreciate it.
I've set up this system and it it is working perfectly; I am now trying to implement security and can't believe this isn't a simple and common thing that I am trying to do.
Thanks again.
Clair