CI 4 Session Iframe Protected - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forumdisplay.php?fid=28) +--- Forum: CodeIgniter 4 Support (https://forum.codeigniter.com/forumdisplay.php?fid=30) +--- Thread: CI 4 Session Iframe Protected (/showthread.php?tid=81666) |
CI 4 Session Iframe Protected - gra - 04-05-2022 I am trying to call an iframe of my site on CI4 with session control. The session is set but when I switch to the controller I don't read the username variable. Code: <iframe id="iframeid" name="iframe" src="http://mysite.loc/?session_username=<?php echo $_SESSION['session_username'];?>&password=<?php echo $_SESSION['password'];?>" width="100%" height="500"/> Set Session: PHP Code: if (null !== $this->request->getVar("session_username")){ PHP Code: $this->session->set($Login); here if I read the session is read correctly. If I switch to another controller the session is no longer read, but only with iframe, if I use the main project with CI4 the session is read correctly. The other controller: PHP Code: if(isset($this->session->username)){ Do I have to set up the CI4 configuration specifically to use iframe ?? Code: id ip_address timestamp data I noticed that the session is reset and creates a new one. only with iframe. the first two. if I use the original project it creates only one session and is kept. The last one. RE: CI 4 Session Iframe Protected - ignitedcms - 04-06-2022 Asides from the issues with iframes, I was wondering if this was an urlencode issue? RE: CI 4 Session Iframe Protected - gra - 04-06-2022 (04-06-2022, 12:13 PM)ignitedcms Wrote: Asides from the issues with iframes, I was wondering if this was an urlencode issue? I don't know much about urlencodes, but taking a look around is essentially passing variables to a certain function. From what I can see under the iframe, I lose the session and the data, it is as if it no longer communicates with the framework and creates a new instance. While if I use it from the codeigniter project everything works. Are you telling me I need to add index.php or change a path? RE: CI 4 Session Iframe Protected - kenjis - 04-07-2022 Modern browsers do not sent Cookie in iframe. Is the site which has iframe the same site? CI4 set SameSite=Lax in Cookie. See https://github.com/codeigniter4/CodeIgniter4/blob/2320793992d9e4ed5d2b5bbe8f9b7a0e547d40f0/app/Config/Cookie.php#L100 |