permitted_uri_chars and $_GET |
[eluser]taewoo[/eluser]
@Edemilson Lima In /system/application/config.php, I tried this Code: $config['permitted_uri_chars'] = 'a-z 0-9~%.:_-+'; and this Code: $config['permitted_uri_chars'] = 'a-z 0-9~%.:_-\+'; For both, I get this error: Code: A PHP Error was encountered
[eluser]Edemilson Lima[/eluser]
When you want to allow the minus (-) in your URI, it must be the last or the first character in your regular expression. In your string you are referencing all ASCII characters from "_" to "\". This will not work.
[eluser]taewoo[/eluser]
So how do i enable "+"? I tried this (recommended from Derek Allard's page): Code: $config['permitted_uri_chars'] = 'a-z 0-9~%.:_=+-' NO luck either... same error
[eluser]rustyvz[/eluser]
[quote author="Edemilson Lima" date="1203546522"][quote author="rustyvz" date="1203537694"]But remember, POSTs (aka form submissions) cannot be bookmarked(and work), so your search result would not be bookmarkable.[/quote] You can bookmark it if you send the form via POST to a controller where you get the fields with $this->input->post() and then redirect() the input as segments to another controller. So, when you make the redirect(), you rebuild the URL with the search string as a segment.[/quote] So, you are saying to take the POST, redirect it to a properly formatted URL, and then have the person bookmark that? So your routine would have to look for: - The POSTed data OR - A GET URL with the data included Is that right? Sounds like it would be a pain. But code is like that sometimes to allow flexibility...
[eluser]Edemilson Lima[/eluser]
I think is much better use base64_encode() insted of url_encode(). Base64 encoded strings only have letters, numbers and the equal sign (=). For example, your view could have a form like this to search a forum messages: Code: <form action="search/forward" method="post"> At your search controller you will have: Code: class Search extends Controller { It is not too painful, I think. ![]()
[eluser]taewoo[/eluser]
@Edemilson Lima How do i enable “+”? (scroll up to see my original question)
[eluser]Edemilson Lima[/eluser]
In a regular expression, the characters Code: ^ . + * ( | ) [ - ] \ ? { } $ You can find more info about Regular Expressions at: http://en.wikipedia.org/wiki/Regular_expression http://www.amk.ca/python/howto/regex/ http://www.regular-expressions.info/
[eluser]taewoo[/eluser]
@Edemilson Lima Sorry to be bugging you about this, but i tried "\+" and "\\+"... none of them seem to work. ANy other suggestions?
[eluser]Edemilson Lima[/eluser]
I don't know exactly what is wrong. What error message do you got? The line that check this in CI is at /system/libraries/URI.php: Code: if ( ! preg_match("|^[".preg_quote($this->config->item('permitted_uri_chars'))."]+$|i", $str)) We could try to change the line above to: Code: if ( ! eregi("^[".$this->config->item('permitted_uri_chars'))."]+$", $str))
[eluser]taewoo[/eluser]
I think you mean.. Code: if ( ! eregi("^[".$this->config->item('permitted_uri_chars')."]+$", $str)) Notice the placement of closing parenthesis. Still doesn't work.... same error regardless of either: Code: $config['permitted_uri_chars'] = '+a-z 0-9~%.:_-'; Code: $config['permitted_uri_chars'] = '\+a-z 0-9~%.:_-'; |
Welcome Guest, Not a member yet? Register Sign In |