0
How can i expired some data to be not viewed any more
php
5 odpowiedzi
0
try using sessions. you can unset session variables so they terminate during the user's session and when the user closes their browser. you can reset them anytime when the session starts again.
0
I want it to be viewed for. 3day . and it expirs
0
then you need to use the php date function.
you can google the date function and how to use it. it looks like
date("h:m:s");
you will need a database if you want users to save their data for 3 days before losing their data.
if you want the users to be logged out after 3 days of inactivity then you can still do it with both the session variable and the date function.
if you dont need a database, you can use javascript to use the user's cache to determine if they used 3 days but this is super hackable (it isn't safe because anyone can change their cache data at any time).
I recommend using sessions and the date function with a database for maximum security.
0
you can also use the session variable with a token. make sure to use the date function to check if a date hasnt passed 3 days. you can check if 3 days are passed. if they are, set the token to something that logs the user out (or changes the session variables for their next page load).<- notice I said next page load. if they still have the same page open, youre still vulnerable. leaving pages open is easy and can damage your site without any reason. have some security ready to handle timeouts to kick people off who are making lots of requests from different threads, pages, ips, and others.
0
super hammered right now but hope this helps!