Codeigniter is the "catch" of URLs, although they were urcoded

I have the strangest problem with codeigniter. I have a website that has a search function that displays a user’s request in a URL so that it can save the URL. I make sure the request text went through rawurlencode before I paste it into the url. However, Codeigniter still launches me on the error page when the request contains a character that is not in my allowed_uri_characters configuration.

So, while my browser says / search -results / query /% 22samplequery% 22, I still get an error about using invalid characters.

This is mistake? I have no invalid characters in my url. I have a% sign and some numbers (which are all specifically allowed). This is definitely the allowed_uri_characters parameter, which gives me sadness. If I add a quotation mark to it, it can execute query% 22 without any problems.

And to be clear, the request comes from the form in the form of post-data, then it is encoded in my controller and then redirected to a new page. Permitted originals must not be allowed to be applied in any way before they are encoded.

This drives me crazy, as my only solution at the moment is to open my allowed_ hands for everything under the sun, which is not very safe!

+3
source share
3 answers

, @ allowed_uri_chars, site_url(). , ... URI CodeIgniter

, . http://sholsinger.com/archive/2009/04/passing-email-addresses-in-urls-with-codeigniter/

allowed_uri_chars , , (?email=bla@bla.com), urlencoding. :)

+1

URL- %20 " "? char.

0

, , . , (search_string, url_title).

Each time you do a search, save the string, generate url_title () and save it to the database. This way you can redirect the user to a secure URL without missing the initial search.

I know that someone will yell at me for this decision. But, if your site is small and your traffic remains low, this is really an acceptable solution.

0
source

Source: https://habr.com/ru/post/1770036/


All Articles