Hi All,
I am trying to create multiple codeigniter sessons for multiple users. I will explain my scenario.
I have developed an application using codeigniter and launched in an ecommerce platfomr so that many shop owners installed my application.
Now from my admin front, I have access to check for each particular user's app interface using the session and redirect method.
I want to make the sessions for all users open in different tabs, when I click on one button.
I have used a for loop.
The iteration works perfect and data are for each user are retrieved perfectly.
But the redirect method opens the session for the first user alone and stops there.
I am just breaking my head on this issue.
I need your help in this issue. I would be very grateful since this is eating my time.

Thanks in advance.

This is the piece of code which I am using.

    /***  Code starts here ***/

    public function login_as_update() { 

    $customer = $this->customers_model->read_allshops();
    if(count($customer) != 0) {

            $cust_array = get_object_vars($customer[$i]);

            $newdata = array( 
           'shop'  => $cust_array['shop'], 
           'token'     => $cust_array['token'], 
           'plan' => $cust_array['plan'],
            'status'  => 'active', 
            'adminaccess'  => true, 
            'id'  => $cust_array['id']





/***  Code ends here ***/

DaniWeb, itself, is written in CodeIgniter so I have a lot of experience with the platform. However, I'm very confused by what it is you're trying to do.

Firstly, the set_userdata() method does not create a new session. Just one session exists. What it does is add custom data to the existing cookied session.

Why are you using ob_start()?

commented: How can i use another custom session in php codeigniter? +0

Hi Dani,
Thanks for your reply. While trying to print, I was getting some error and I googled out and added that ob_start() so that I can print to check for the details are populating properly.
Yes I do understand, set_userdata() does not create a new session.
What I want to do is, to open multiple user interfaces on a button click.
The above code which I have mentioned opens only one interface and stops. But the forloop populates the details for every iteration if the "redirect(Settings::get('shopify_main_page_redirect'));" is commented and with print_r(); statement I confirmed that.

I'm sorry, you need to explain what you mean by multiple user interfaces. Do you mean open two browser tabs off of one click?

commented: Yes you are right. I want to open two browser tabs off of one click. Each tabs will be opening different sessions. +0

@P, isn't that fundamentally broken as by popup blockers and more?

Put another way, even if you got it to work, the user's browser settings could break it. I would not implement this just on these issues alone.

Yes you are right. I want to open two browser tabs off of one click. Each tabs will be opening different sessions.

This could be done with simple Javascript. Simply use window.open("https://www.new-url.com"); You can trigger it when a link is clicked. Nothing to do with PHP or CodeIgniter. Also, both browser tabs will use the same CodeIgniter session.

All that being said, I agree with rproffitt in that it's a very poor user experience and therefore strongly not recommended.

commented: A javascript approach is more likely to work. +15

Let's roll back to where you wrote "all users open in different tabs, when I click on one button."

How about simple? If your site allows something like www.somesite.com/?user=donnie then almost all browsers all you to create a folder of URLs with ?user=donnie then ?user=marie , ?user=osmonds and so on that in a browser I can use that group and open all tabs in that group.