URL via javascript into CodeIgniter - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21) +--- Thread: URL via javascript into CodeIgniter (/showthread.php?tid=1726) |
URL via javascript into CodeIgniter - El Forum - 06-22-2007 [eluser]Doncqueurs[/eluser] Hi, I ran into a little problem and couldn't really find an answer in this forum. It seems like there has been a closely related issue a year ago, but unfortunately that didn't help me to solve the problem. I try to do the following. With this piece of javascript I would like to add url and sitename to my application. Quote:java_script:location.href='http://localhost/index.php/bookmarks/add/'+encodeURIComponent(location.href)+'/'+encodeURIComponent(document.title) This results in the following URL: Quote:http://localhost/index.php/bookmarks/add/http://www.codeigniter.com//CodeIgniter%20-%20Open%20source%20PHP%20web%20application%20framework On the receiving end I have this script: Quote:<?php If things were working fine this would display something like: Quote:URL: http://www.codeigniter.com Instead I get: Quote:Not Found Conclusion, it seems that CodeIgniter decodes the javascript urlencoded before it is told to do so. This results in requesting a URL that doesn't exist. Is there anybody who found a way to work around this? Thanks, Jochem PS. I tried to give full information I hope that I succeeded in it. In case you miss something please drop me a note. (I use a recent - last two weeks - download - last two weeks - of CodeIgniter). URL via javascript into CodeIgniter - El Forum - 06-22-2007 [eluser]Phil Sturgeon[/eluser] I'm betting your trouble comes from lines 503-504 of libraries/Input.php Code: $str = preg_replace("/&#xu0;([a-z0-9]{3})/i", "&#x\\1;", $str); This should be disabled in the /config/config.php but perhaps its either on or not working for you. If you can set: Code: $config['global_xss_filtering'] = FALSE; If it is already false, then either comment out the two lines I mentioned in the input library, or include an if saying Code: $CI =& get_instance(); Then this XSS_CLEAN function will only run if its not this page. anyone got a batter idea? >.< URL via javascript into CodeIgniter - El Forum - 06-23-2007 [eluser]Doncqueurs[/eluser] Unfortunately, these suggestions didn't solve the problem. URL via javascript into CodeIgniter - El Forum - 06-23-2007 [eluser]gunter[/eluser] whenever you have urlencoded slashes then the problem occurs, right? so if you are calling http://www.yoursite.com/controller/function/segment%20hello then apache tries to load the file segment/hello and not anymore the controller... I don´t know how to fix that (so Apache don´t decode it automatically...) , but there were some postings with that problems (url in segment): search in the forum for the keywords: segment slash http://ellislab.com/forums/viewthread/47842/ http://ellislab.com/forums/viewthread/53931/ URL via javascript into CodeIgniter - El Forum - 06-24-2007 [eluser]Phil Sturgeon[/eluser] If you REAAAAAALLY get stressed with it, perhaps enabling good old fashioned query strings will work for you? Then manually recreating the / based segments using some htaccess rules of your own? Just a thought 8-/ |