I need to display the current date everytime a user clicks to download a certain file. Example if the user downloads a pdf on sept 3 then again on sept 8 i would like to display the last time the user viewed that pdf.
When they visit a page, check the cookies array for the last date they visited and use that if it's there. Then write the current date to a cookie, so it's available for step 1 next time.
Also keep in mind that the only way to do this deterministically is to be able to uniquely identify the user.
If you require a user login, you can use PHP code to fetch the last download date. I'd store the data in a MySQL database.
If you do not require user logins, there is no way to deterministically identify a particular user. Cookies are a partial solution -- but a user can always clear his cookie store.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.