passing an encoded url .. |
[eluser]/larry[/eluser]
I have a controller called filter that basically sets up a redirect to another controller called filterlist. It encodes a url as one of it's arguments. filterlist is then set up to do pagination: filter does this: $val = urlencode($filter_val); redirect("/widget/filterlist/$val/$fld"); the resulting url then looks like this: http://my.local/widget-admin-codeigniter...l_addr_url What I get is this error: The requested URL /widget-admin-codeigniter/index.php/widget/filterlist/http://ajaxian.com/index.xml/xml_addr_url was not found on this server I saw that I can set up Codeigniter to use parameters instead of the usual url scheme it uses, but it appears I can't do it both ways, and I think doing that will change the browser caches the pages as well, so I'm not sure that's a good approach. I guess you can't mix the two ? Otherwise I would try maybe: widget/filterlist/$fld/?val=$val The way around it seems to be to use a session, which is not ideal, but the site is an admin interface and won't get any real traffic. Any ideas appreciated ...
[eluser]louis w[/eluser]
Looks like passing a full url in the query is way too messy. You should try one of your other options. Session is a good idea. You could set a flashdata item so that way it would be auto destroyed. You may just want to turn on the get input values and pass it in the query param thou.
[eluser]/larry[/eluser]
It sounded like turning on the $_GET parameters makes the usual code igniter type URLs to not work ?
[eluser]louis w[/eluser]
They can work in tandem. I turned on query strings for the admin portion of my application. In your config: Code: $config['enable_query_strings'] = TRUE; Then in your controller you just reference: Code: $val = $this->input->get('val'); I was just thinking thou, have you thought about base64 encoding the url. That way it would just be a a-z0-9 string.
[eluser]/larry[/eluser]
I tried what you suggested and it didn't work, I get nothing for: http://my.local/widget-admin-codeigniter...?val=green base 64 won't have any forward slashes ?
[eluser]louis w[/eluser]
Shouldn't. Check it out: http://www.php.net/base64_encode Also check out the comments, i see some down there for urls.
[eluser]/larry[/eluser]
I started using it as it seems like it was working, but then there was "=" at the end of the encoded string and I got an error saying illegal characters in URL
[eluser]louis w[/eluser]
[quote author="/larry" date="1212630634"]I started using it as it seems like it was working, but then there was "=" at the end of the encoded string and I got an error saying illegal characters in URL[/quote] Check out the first comment on the php page. Looks like someone has a little function to str_replace the =
[eluser]/larry[/eluser]
Using ',' instead of '=' like it shows there didn't work, but I tried using '.' instead and that seems to work. Thanks alot, I was almost going to try hexidecimal
[eluser]/larry[/eluser]
but then someone wrote this: "a note on URI -safe base64. Simply replacing + = and / with _ - and . doesn't work as the base64_encode function will insert \r \n chars as well which are not URI-safe. So unless we have a base64encode function that does not insert any newline and padddings, the output can never be URI -safe." |
Welcome Guest, Not a member yet? Register Sign In |