Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
I want to reset fueldid

  • We use database for control session;
    There is the data in the session may be missing in the database. 
    At that time, I will not be able to use the session. 

    I think it is good if you issue a new "fueldid", but does not know how. 
    How would you know how?

  • Not sure what you mean.

    If you have a session id in the cookie that can't be found in the database, a new session will be created automatically. If you want to destroy an existing session, use \Session::destroy().
  • Thank you reply.

    I try "\Session::destroy()" or "\Session::create()". bat not work.

    (Page1)
      Session::set('userid','hoge');
      Log::debug( Session::key() );   // (1)

    (Page 2)
      $uid = Session::get('userid');
      Log::debug( Session::key() );  // (2)

    usually (1) and (2) is same value.
    But When session do not found in database , (1) and (2) is different value;

    When manually delete "fueldid" cookie or shutdown browser, repaired it.
    So I think want to reset "fueldid".
    please help me.
     
  • Obvious.

    If the session does not exist, page 2 will create a new session. And $uid will be NULL, since no value called 'userid' will exist in this new session.

    This is how every session works?

    What do you think you repair by deleting the cookie? When you request page 2 after that delete, you still have a new session key, and $uid will still be NULL...

    And you are sure you're on the current Fuel release? There was an older release that had some issues with auto creation of new sessions (1.4 or 1.5 I think), so make sure your on the latest version.
  • This is not every session.
    I do not know the details of the timing at which the phenomenon occurs. 
    This may happen when session time out, but cookie "fueldid" does not expire. 

    I tried the following two methods, but it was not possible to delete cookies ”fueldid”

    \ Cookie :: delete ("fueldid") 
    setcookie ("fueldid",'', time () - 1800, '/'); 

    As pointed out, the version was 1.4. 
    How can I fix without upgrading

  • You should ALWAYS be able to delete a cookie using setcookie() or \Cookie::delete().

    If that doesn't work, you either have an entirely different problem, or your diagnosis is wrong (for example, are you sure it's the same cookie you are looking at? Fuel will re-create it immediately if it's missing).

    A lot changed since 1.4, so fixing things without upgrading isn't going to be easy, and probably will take more time then upgrading to 1.7.1, and making the few changes to your app code that comes along with that (check the changelog's of 1.5, 1.6 and 1.7 before you start).
  • Thank you reply.
    I'll suggest upgrade to our project team.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion