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: If statement in QML
Answer: Another form to slove this is

Rectangle {
    ...
    color: {
       color = hand.handCallColor
       if(hand.callValue &gt;= hand.handRaiseXBB)
           color = hand.handFoldColor
    }
    ...
}


But the form with ternary operator is a better form!

QML is "based" in javascript, then i belive that all itens are javascript objects, how to:

var Rectangle: {
   color: "red",
   id: "id",
   //then we can do this
   setColor: function(_color) {this.color = _color}
}