Welcome Guest, Not a member yet? Register   Sign In
Receiving a URL as a string parameter...
#1

[eluser]gvillavizar[/eluser]
Hello everybody,

Here is the problem I have right now:

I need to receive part of an url from a remote url in order to display that page in an iframe inside my page (iframes are bad i know, but i had no choice).

So, whenever they access mysiteurl.com/frame/content/index.asp?display=content

The part that is part of my url is mysiteurl.com/frame/

What I am receving is: content/index.asp?display=content

At first I received the disallowed characters error, so I changed to this on my config:

Code:
$config['permitted_uri_chars'] = 'a-z 0-9~%.:_\-\?\&\=';

There should be a better way of doing this, but since it works I am not worried for that.

Next, I get a 404 error page, I assume CI is looking for a function named content and passing index.asp?display=content as a parameter to that function.

My question is, how can I enable the routes to make CI think that content is not a function in my frame controller?

I tried doing this in my routes.php

Code:
$route['frame/(:any)/(:any)'] = "frame/$1/$2";

Didn't work.

Code:
$route['frame/(:any)/(:any)'] = "frame/$1$2";

Either...

Any help is greatly appreciated.
#2

[eluser]slowgary[/eluser]
Not sure, but why not just change the format that the data is sent in? Just use clean directory style URLs, e.g.
Code:
/content/display

Maybe if you describe what it is you're doing someone could suggest a better way.
#3

[eluser]TheFuzzy0ne[/eluser]
You can encode/decode the URI using a helper I made some time ago. http://ellislab.com/forums/viewthread/107741/.
#4

[eluser]gvillavizar[/eluser]
[quote author="slowgary" date="1245453829"]Not sure, but why not just change the format that the data is sent in? Just use clean directory style URLs, e.g.
Code:
/content/display

Maybe if you describe what it is you're doing someone could suggest a better way.[/quote]

I can't really change the format of the link because I should just get the querystring through a parameter and then load the iframe with the querystring attached to the foreign url.

That's not under my control.
#5

[eluser]bretticus[/eluser]
[quote author="gvillavizar" date="1245459821"]
I can't really change the format of the link because I should just get the querystring through a parameter and then load the iframe with the querystring attached to the foreign url.

That's not under my control.[/quote]

You don't have to change the format of the link, but you can take the variables as a normal CI path and write them dynamically server-side in the correct format in your iframe tag.

Be aware that any time you allow the URL of the iframe of be changed from the parent window, you open the possibility for cross site scripting (even if you obfuscate it using base64.)
#6

[eluser]TheFuzzy0ne[/eluser]
If you need security, I created a URI safe encryption library extension (try saying that with a mouthful of cornflakes...). http://ellislab.com/forums/viewthread/109429/
#7

[eluser]bretticus[/eluser]
Ah FuzzyOne, you think of everything Wink I usually do this by building a random key in the database, now I have a way to skip that step. Thanks.




Theme © iAndrew 2016 - Forum software by © MyBB