Welcome Guest, Not a member yet? Register   Sign In
Query strings and function paramters
#1

[eluser]Kevin_3_57[/eluser]
Hi people!, due to some problems using the Facebook Api, I had to enable query strings in my URLs.

The problem is this: I use to have a controller with some functions which were accessed like this: Profile/view_profile/42, where Profile is the controller, view_profile the function and 42 the argument.

So, with query string enabled, when I call this function it must be something like this: index.php?c=profile&m=view_profile

Bur what about the argument? I tried with &profileID=42 at the end (my function is declared as view_profile($profileID)) but that didn't work.

So people, any suggestion to this?

Thanks very much!
#2

[eluser]Myles Wakeham[/eluser]
Those parameters should be part of your $_GET array. Have you tried doing a print_r($_GET) in PHP to see if you have access to them?

Myles
#3

[eluser]Kevin_3_57[/eluser]
I just realized that 5 minutes ago. So the only solution to this is to get the parameters and it's value through $_GET right?
#4

[eluser]Myles Wakeham[/eluser]
[quote author="Kevin_3_57" date="1276725905"]I just realized that 5 minutes ago. So the only solution to this is to get the parameters and it's value through $_GET right?[/quote]

Well its not the only solution. The URI is just text. You can parse it just like any text string. But if it is submitted to you, and you want to just traverse the $_GET array, the values are right there to extract. Just make sure you apply appropriate XSS filtering on anything coming into your app though.

Myles
#5

[eluser]coldclimate[/eluser]
@Kevin_3_57

Have yo managed to get the new graph API working for logging users in etc. We (wishli.st) are battling with it again this week, and query strings seem to be the only was to get a session back, but then "shag up"* all our existing application and it's lovely URLS. Fancinated on how other people are getting on.


Cheers,
oli

NB: * Shagging up is a well know technical term. honest gov.
#6

[eluser]Kevin_3_57[/eluser]
I have another post with login and session trouble with Facebook, is this what's happening to you?
http://ellislab.com/forums/viewthread/157644/

Cheers,
Kev.
#7

[eluser]coldclimate[/eluser]
Hmm, thanks Kev, certainly looks similar. I'll have a poke through and tomorrow is booked in as a massive hackathon. If I get thinking working, I'll post it back up here as always.




Theme © iAndrew 2016 - Forum software by © MyBB