Welcome Guest, Not a member yet? Register   Sign In
Session vars scope
#1

[eluser]cattox[/eluser]
Hi All,

At first, I was working without iframes and I had no problem with session variables, they were working fine.
Then I needed to transform my webpages layout and i built a page with an iframe. The page that is included as an iframe puts some variables in session. The problem is, the other pages can't access the session vars the iframe page create. That's odd. The iframe page creates and access the session vars it creates, but other pages can't see them.
Let me clarify only one thing: All pages can access default session vars (session id, ip, etc), they just can't see the ones created by the iframe page.
Am I doing something wrong?

Does anyone have a solution for this?
#2

[eluser]Randy Casburn[/eluser]
Hi cattox,

If the content for the iframe is coming from a different server as the other pages, that would do it.

Its also possible that you could be doing things in the wrong sequence:

Code:
load Session class
access Session variables
load iframe (this loads up the Session class again)
access Session variables from original pages  -- whoops - they don't exist because we restarted Session

Hope this helps,

Randy
#3

[eluser]cattox[/eluser]
Hi,

thanks for the reply.

All pages belong to the same server, so the first possibility is out of question.

I will give you a more accurate image of my case:

I have a master page with several content. One of them is an iframe witch contains the login page. I choose to do things this way in order to have a controller dedicated to login. So, login page puts some data in session. Then I navigate to other page where I try to access session data. In this new page, if I load session class, I get my session data restarted, but if I dont load it, my session vars are not defined...

As far as I could read in the CI manual about Session, it allways tries to load an existent Session before creates a new one, so this shouldn't be a problem.

I still can't see what I am missing...
#4

[eluser]cattox[/eluser]
Maybee if I tell you my #1 objective you can help me better:

I want to keep 'login form'/'wellcome message' visible in all the site pages.

can you help me with that?




Theme © iAndrew 2016 - Forum software by © MyBB