Period changed to underscore - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: Period changed to underscore (/showthread.php?tid=12373) Pages:
1
2
|
Period changed to underscore - El Forum - 10-16-2008 [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? Period changed to underscore - El Forum - 10-16-2008 [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) ??? Period changed to underscore - El Forum - 10-16-2008 [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? Period changed to underscore - El Forum - 10-17-2008 [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. Period changed to underscore - El Forum - 03-03-2009 [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 Period changed to underscore - El Forum - 03-03-2009 [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. Period changed to underscore - El Forum - 03-04-2009 [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. Period changed to underscore - El Forum - 03-04-2009 [eluser]Colin Williams[/eluser] Haha.. saw your orig message in the email. Guess you got it now? Period changed to underscore - El Forum - 03-04-2009 [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] Period changed to underscore - El Forum - 03-04-2009 [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. |