CodeIgniter Forums
Passing session id in the URL - 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: Passing session id in the URL (/showthread.php?tid=6255)



Passing session id in the URL - El Forum - 02-20-2008

[eluser]simonspoken[/eluser]
I have a site which I'm currently moving over to CodeIgniter. Because of the nature of the site (a mobile site), there is no guarantee that cookies will be supported (either by the handset, or stripped out by the mobile network - it happens).

To combat this, I store a session id in both a cookie and the URL (cookie being the preferred method, because we can track repeat visits). On each load of the page, it goes off to the database and pulls out all the relevant information for that session.

For example, a URL on the non-CI site looks like this:
http://www.ourURL.mobi/97b549ce7c78c9d7/somepage
http://www.ourURL.mobi/97b549ce7c78c9d7/somepage/anotherpage

I'd like to replicate this across to CI, but I'm not sure where to begin. Can anyone point me in the right direction? I have the class doing the tracking now - I just need to get CodeIgniter to understand the URL's.


Passing session id in the URL - El Forum - 02-20-2008

[eluser]ekeretex[/eluser]
I think you will be better off adding the session parameter at the end of the url rather than where it is currently.

You could then test for that parameter in the controllers.


Passing session id in the URL - El Forum - 02-20-2008

[eluser]wiredesignz[/eluser]
Take a look at the user guide _remap() function, the first uri segment is passed to it so you can validate your sessions there, and then grab the other segments to get your pages


Passing session id in the URL - El Forum - 02-20-2008

[eluser]simonspoken[/eluser]
[quote author="wiredesignz" date="1203537426"]Take a look at the user guide _remap() function, the first uri segment is passed to it so you can validate your sessions there, and then grab the other segments to get your pages[/quote]

Great - this worked. Thanks for your help. Smile