Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 9 years ago.
Improve this question
I have a some forms that stores data in my page.
I want to find a way to temporarily save the data entered by the user in navigating and keep until the order is confirmed.
Can anyone help me?
This is exactly what sessions are for
While I was working on e-commerce sites we used to keep all the order data
in sessions until user confirms order by going to payment gateway.
You can use PHP Session as arrays and store your data temporary and then destroy the session.
$_SESSION['cart'][] = //you data here
Sessions and cookies are used for this purpose but sessions are more secure and reliable.
Related
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 years ago.
Improve this question
I have an admin page where some users can have access to but I want that whenever they leave the site or close the tab for about an hour or a day the session should be destroyed so as not to allow someone else.
The thing you are searching for is $_COOKIE. There you can define how long the Variable is saved etc. The only thing you will have to consider is that the values are stored locally and not on the server. If you want to achieve that, you can create a Cookie-Key system similar to the one PHP uses to save the Session data on the Server. In that Case the User would get a key, saved as a cookie and the data is stored on the server under that key.
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 7 years ago.
Improve this question
I was wondering if it was a good practice to store the infos we retrieved from a DB (more specificaly the user infos) inside a session, useful for the login for example :
e.g :
$sql="SELECT * FROM USER";
$result=$myConnexion->query($sql);
$line=$result->fetch_assoc();
$_SESSION['login']=$line['login'];
$_SESSION['name']=$line['name'];
...
It then would be easier to display infos, welcome messages and so on.
What do you think ?
Thank you for your time
It's perfectly fine. Make sure you only store Public info you might need later on, meaning don't store the password or the user's ID in the db.
Yes, it's fine, as long as you don't store sensitive data, like the password, or the user name. You can check this for more
Using PHP SESSION Variables to store MySQL query results
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 9 years ago.
Improve this question
I have a some forms that stores data in my page.
I want to find a way to temporarily save the data entered by the user in navigating and keep until the order is confirmed.
Can anyone help me?
This is exactly what sessions are for
While I was working on e-commerce sites we used to keep all the order data
in sessions until user confirms order by going to payment gateway.
You can use PHP Session as arrays and store your data temporary and then destroy the session.
$_SESSION['cart'][] = //you data here
Sessions and cookies are used for this purpose but sessions are more secure and reliable.
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 9 years ago.
Improve this question
I have a some forms that stores data in my page.
I want to find a way to temporarily save the data entered by the user in navigating and keep until the order is confirmed.
Can anyone help me?
This is exactly what sessions are for
While I was working on e-commerce sites we used to keep all the order data
in sessions until user confirms order by going to payment gateway.
You can use PHP Session as arrays and store your data temporary and then destroy the session.
$_SESSION['cart'][] = //you data here
Sessions and cookies are used for this purpose but sessions are more secure and reliable.
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 9 years ago.
Improve this question
Is it frowned upon/ a bad idea to store information temporarily in a session variable to give access to that information globally?
I have a file upload parser script that is called by ajax on submit of a form and I need to send back data at different parts of the script. I figured saving the information I need in different session variables might be a good idea.
In your case you can store temporary data ( not critical data which compromises with the security ) as a session cookie in the clients' browser.