Welcome Guest, Not a member yet? Register   Sign In
Tansfer variable between views
#11

[eluser]Salim[/eluser]
one more question ...

Consider I use the database method. I will post user's info in a temp table using the session_id to recongnize user's data... What will happen if the session is expired ??

How can I manage the fact that is session is expired, user will be redirected to the step1 view ??

Thanks in advance
#12

[eluser]xwero[/eluser]
Yes if the session expires the user has to go back to start. You could provide an option to save the registration for a later date but then the user has to leave a valid email address and then you could add a temporary password to continue with the added values.
#13

[eluser]Kromack[/eluser]
Maybe add a timestamp field to the table and allow x minutes to complete the form before data are deleted from the database ?
#14

[eluser]Salim[/eluser]
Kromack,

This is what i want to do, but how is it translated in php ? Where do i have to put he code ? In the controller ?

thanks
#15

[eluser]Kromack[/eluser]
So,

I think it should gone like this :

When the user have completed one step, you put all data in your table with :

- The session id
- The id of the step
- All datas
- the current timestamp (see the time() function or the date helper)

Then, when a step is validate, you have to check if the user have completed all precedent steps (use the the session id to find your user).

By using this method, if the session of an user expire, the session id will mismatch. So he have to redo all steps.

The next problem is to purge your table (in fact to remove all row with a session id expired).

You can create in your controller a function :

Code:
public function purge() {

//Get current timestamp
//Calculate the timestamp offset (now - X seconds)
//foreach row
////calculate the offset of the row (stored timestamp + x seconds)
////if((stored timestamp + x seconds) <= (now - X seconds))
////then delete the row
////endif
//endforeach


}


Ok, in France it is the morning, so I'm a little like this : :long:

If you have any problem, you can ask Wink

Good luck
#16

[eluser]Salim[/eluser]
THanks,

I'm in France too ...

Haev a nice day




Theme © iAndrew 2016 - Forum software by © MyBB