How can i expired some data to be not viewed any more | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How can i expired some data to be not viewed any more

php

5th Jul 2018, 9:31 AM
Eazy Wizzy
Eazy Wizzy - avatar
5 Answers
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.
5th Jul 2018, 2:14 PM
Xpl0it
Xpl0it - avatar
0
I want it to be viewed for. 3day . and it expirs
6th Jul 2018, 4:26 PM
Eazy Wizzy
Eazy Wizzy - avatar
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.
6th Jul 2018, 5:21 PM
Xpl0it
Xpl0it - avatar
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.
6th Jul 2018, 5:26 PM
Xpl0it
Xpl0it - avatar
0
super hammered right now but hope this helps!
6th Jul 2018, 5:27 PM
Xpl0it
Xpl0it - avatar