Period changed to underscore |
[eluser]Dan Bowling[/eluser]
I have a method that takes an email address from the URL and sends and email to it. For some reason, periods are changed to underscores. Code: function byaddress($address = false, $send = false) If my url is controller/byaddress/[email protected] then the output will be firstname_lastname@example_com. I'm really confused. The first thing I tried was setting up the proper config for permitted URI characters, I'm using the following at the moment: Code: $config['permitted_uri_chars'] = 'a-z 0-9~%.:_\-\,@()'; I can't simply use string replace, because an email may actually have an underscore in it (which seems to be left alone in my case.) Any ideas?
[eluser]Colin Williams[/eluser]
Cool. So, once you get it working, I can spam a bunch of people by writing a script that repeatedly hits that URL with different email addresses ![]() I assume that the Router class might greedily be converting all URI parameters to something that could match a class or function name. Have you tried using $this->uri->segment(3) ???
[eluser]Dan Bowling[/eluser]
I hadn't tried that, but now I have and the problem persists. This project is for the intranet of a small non-profit. All this functionality is behind an authentication layer. Better luck next time with the spamming? ;-) Any other ideas on where to look?
[eluser]Dan Bowling[/eluser]
I seem to have found a fix. Though I don't understand why it works yet, and I have no clue how it will interact with the rest of my application. I changed my URI Protocol config from AUTO to QUERY_STRING: Code: $config['uri_protocol'] = "QUERY_STRING"; It now returns the proper information. At the moment, this solution works on my XAMPP (Apache) development box, but I am deploying to an IIS 6 server, so we'll see if it works there too.
[eluser]phazei[/eluser]
I'm having the exact same problem. A '.' in the url is being converted to '_' The thing is, it was working just fine yesterday. Only thing I did was change the htaccess to remove www. Hmm, while writing this I was racking my brain and trying with and with out the www's and the htaccess code. I found it only does it when I don't include 'index.php' in the url. Code: //domain.com/index.php/main/email/[email protected] Could it be the htaccess redirect doing it, or CI? Code: RewriteCond %{REQUEST_FILENAME} !-f
[eluser]Colin Williams[/eluser]
I think the case is that your server is injecting the underscores for periods when it fills the PATH_INFO environment variable. Tell CI to use REQUEST_URI instead and the problem goes away. It's not CI's doing.
[eluser]phazei[/eluser]
It seems to build the URI string with PATH_INFO when 'index.php' is used. Without index.php it builds it with $_GET. So the $_GET is converting it I guess.
[eluser]Colin Williams[/eluser]
Haha.. saw your orig message in the email. Guess you got it now?
[eluser]TheFuzzy0ne[/eluser]
Just a random thought. What happens when you make this the last line of your htaccess file: Code: RewriteRule ^(.*)$ index.php?/$1 [QSA,L]
[eluser]phazei[/eluser]
Yeah, I read what you said once again and thought 'duh'. I'm just looking at what's available when currently. PATH_INFO only exists when it uses the index.php, otherwise it's empty Both $_GET and QUERY_STRING exist when I don't have index.php. QUERY_STRING shows everything correctly. I was wondering if any selection was 'better'. As long as one works in one configuration, as long as that doesn't change, then it doesn't matter I guess. The live site won't ever have the index.php so it won't ever need to use path_info. |
Welcome Guest, Not a member yet? Register Sign In |