0

Sir I have a search engine on my website which get input by user and search it for the results and i am storing those keywords into seperate table name keywords, but now a days i m checking that there is a bunch of unknown characters into query strings, i have used htmlspecialchars() funcntion and mysql_real_escape_string() functions to check if it will help me but i m not success i have attached the db image to you guyz to check and help me out, and also give me a mysql query to so with at once i can remove those chars from my db and can clean my db and in future i want to prevent those keywrods from inserting into my db thans! and tell me which of the keyboard keys which making this type of keywords thanks!

d9549f2f18eabd79381254f88a998333

4
Contributors
8
Replies
41
Views
4 Years
Discussion Span
Last Post by 4fridi
0

shouldn't you first take query string apart into keywords and THEN save them? what exactly is the code you tried and your result? Please be more specific so people can help you....

1

That looks like incorrect saving of unicode characters, so my guess is that someone is using arabic, cyrillic or any other non latin encoding in your search.

Edited by pritaeas

0

That looks like incorrect saving of unicode characters, so my guess is that someone is using arabic, cyrillic or any other non latin encoding in your search.

yes you are right one of my friend outside of this community told me that you should use utf8 uni code into your meta tags so then this type of nonsense characters will be prevent from inserting it into db, if you guyz has more information please share with me or i will be consider that MR PRITAEAS as solved post thanks!

0

Okey I have done as you told me so now what about already done with my db entries how to remove these annoying characters from my db what should b the query for removing those keywords thanks!

0

Also help me if user has input with non english words so i can removce those none english words from the string

1

You might be able to run some query like:

DELETE FROM table_name WHERE some_column LIKE '%<some special character>%'

The percent signs are wild cards, so you would just take what ever character you are looking for (copy and paste?) and stick in between the %%. I have never tried this though, so I am not entirely sure that would work with what you are trying to do.

To keep people from entering in the foreign double byte characters, you could do some form validation in PHP with preg_match or something else, and check for non standard latin characters on the input.

An example (that might just work):

preg_match("/^[\w\d\s.,-]*$/", $string)
0

Thanks pixelsoul for helping me out i have already solved the problem with some of bit searching on google and thanks for your reply with same solutions now i m marking this thread to solved.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.