Welcome Guest, Not a member yet? Register   Sign In
CI 4 Session Iframe Protected
#1

(This post was last modified: 04-06-2022, 09:56 AM by gra.)

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")){
            $data["session_username"]= strtoupper($this->request->getVar("session_username"));
        } else {
            $data["session_username"]="";
        }
        

        
if (null !== $this->request->getVar("password")){
            $data["password"]= $this->request->getVar("password");
        } else {
            $data["password"]="";
        }
        $Login= ['username'  => $data["session_username"],'logged_in' => TRUE]; 
PHP Code:
        $this->session->set($Login);
        $this->session->username// ok read username 

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)){

  $this->Main();


Do I have to set up the CI4 configuration specifically to use iframe ??


Code:
id ip_address timestamp data
Iframe send data
orbpspifh14ef6gi9dj67gdlpcpm238v 127.0.0.1 2022-04-06 18:32:56 [BLOB - 293 B]
a1pg5md365h4jae2oqhtmbg9h2mmvcfg 127.0.0.1 2022-04-06 18:32:56 [BLOB - 34 B]
Project CI4 
gv6gnm04pqlpp2nahr2eekvm0va9g2ae 127.0.0.1 2022-04-06 18:51:13 [BLOB - 369 B]


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.
Reply


Messages In This Thread
CI 4 Session Iframe Protected - by gra - 04-05-2022, 09:41 PM
RE: CI 4 Session Iframe Protected - by ignitedcms - 04-06-2022, 12:13 PM
RE: CI 4 Session Iframe Protected - by gra - 04-06-2022, 11:13 PM
RE: CI 4 Session Iframe Protected - by kenjis - 04-07-2022, 12:34 AM



Theme © iAndrew 2016 - Forum software by © MyBB