0

I keep loosing session data on redirect for users with Internet Explorer on my L5 website.

Session data lost on normal redirect. I don't seem to be alone (10,000 views ie9 loses cookies after redirect ). But even explicitly flashed data is lost on redirect, see second redirect version of code ->with().

I have done the basic homework and added P3P as part of header based on Stackoverflow suggestions.

First Controller

public function getVerifyClient(){

    // If user is an existing client
    if(\Auth::check()){
        if (\Auth::user()->role == 'Client'){
//              dd(Session::get('service')); <-- Selected service part of session 
            return redirect('order'); <-- Session data lost
            return redirect('order')->with('service', Session::get('service'); <-- Session data lost even with explicitly flashed data
        }
        \Auth::logout(); // Logout employees etc so they do not book in their account
    }
    ...
}

Second controller

public function getOrder(){
    dd(Session::get('service'));
}

Session.php

My session.php is set to normal standards ('domain' => null, 'path' => '/' etc), only exception is 'encrypt' which is set to true rather than false.

Community
  • 1
  • 1
Peder Wessel
  • 646
  • 1
  • 9
  • 23

1 Answers1

0

i threw away all the functions and ended up re-declaring sessions in a simple way.

You don't need to worry if cookies enable or disable. You just have to re-declare parts of your scripts (variables-the data which you want to display) in a if else condition. Just redeclare the same thing using !isset and then else with the same variables mentioned twice in the if else condition, if you understand what i mean.e.g

if (!isset etc){A+B}  else {A+B}. 

It will call back the same variables over and over either refresh, submit or jump menu etc. you don't need to worry losing session or data. And make sure start session is above the page and define a session e.g

session['id'] on that page which you claim session data missing.

no need to worry about headers or white lines, it has actually nothing to do with it. I've tried it a million times. You don't need to bother using ajax etc. The logic is simple. PHP can do almost everything.