I would like to make a PHP if condition code that will check if the last 10 articles or 10 minutes from the article reading by the user have already elapsed.

E.g. 

A user open a page with id = 235 (this id value is in the url localhost/article/235 )

and this id value will be saved in session with a current timestamp and maybe his IP address

Then he read another article and the same will happen.

I need to remember the clicked stuff for another ten clicks and then reset that only for the first row. E.g. after the 10th click the id and timestamp will not became 11th row but will replace the 1st row in the list.

The php condition in CodeIgniter will then check these values and will update the article hit counter value in the articles table and column counter like this:   

   $this-&gt;db-&gt;where('id', $id);
   $this-&gt;db-&gt;set('counter', 'counter+1', FALSE);
   $this-&gt;db-&gt;update('articles');


But before calling this code I need to make this check from the session?

How to do that?

I think storing e.g. 10 entries in the session with timestamps per user will be enough.

Just don't save the same page in the session twice.

And the condition will check the current timestamp with the saved one and if it is more than e.g. 10 minutes or the user have read/clicked another 10 articles it will allow the update counter php code.

I don't need to have this bulletproof. Just to disable the increment using browser's refresh button. 

So, if he wants to increment the counter he will need to wait ten minutes or read another 10 articles ;)


Question: Why are the two buttons on the apple TV remote shaped differently (Menu & Play/Pause)
Answer: Like mentioned, it's primarily to differentiate them without a visual. Another reason, and probably less so is that since the menu button is concave you're less likely to accidentally trigger it. So if you're playing a video and you accidentally trigger play/pause it's not so bad whereas triggering menu will take you out of the video completely.

Car remotes often follow a similar pattern. The unlock button is concave and the lock button is convex.