how does "recent history" work on sites for php? (PHP)

Posted by ggfan on Stack Overflow See other posts from Stack Overflow or by ggfan
Published on 2010-05-11T04:35:41Z Indexed on 2010/05/11 4:44 UTC
Read the original article Hit count: 225

Filed under:
|

I'm not sure if there is an explanation on SO for beginners, but if so, could you provide the links.

I am interested in creating a "recent viewed" function that shows what links they clicked on before. I'm not sure if this is the 'correct' way to do it, but this is what I have so far...

  1. user clicks on a link(say ad.php?posting_id=12).
  2. if the user doesn't click on the link, no cookie or session is stored for the link
  3. if the user clicks on the link, it sets a cookie for $_cookie['ad.php?posting_id=22']
  4. Each time the user clicks, more cookies are set
  5. In the recent viewed function, it gets all the $_cookie variables and displays them.
  6. if the user wants to clear the history, just destroy all the cookies

I'm not sure if this is the way to do it, but is the viable? If not, what are the steps to create a "recent viewed" function

© Stack Overflow or respective owner

Related posts about php

Related posts about recentviews