mahmoodee
Member
Hello
I add field element called 'hitcount' to my list .
I create a PHP form submission script and select 'onBeforeLoad' for 'Process script'
the code work fine.
my problem : If the user reload the page , the hitcount value will be increase by 1, so the user can increase number of visits 100 , if he reload the page 100 times.
Could you give me hints How do I prevent the user from that ,so that is calculated by a single visit to the user no matter how he reload the page .
thank you
I add field element called 'hitcount' to my list .
I create a PHP form submission script and select 'onBeforeLoad' for 'Process script'
Code:
if (!$formModel->isEditable()) {
$rowid = $formModel->getRowId();
if (!empty($rowid)) {
$db = FabrikWorker::getDbo();
$query = $db->getQuery(true);
$query->update('yourtable)->set('hitcount = COALESCE(hitcount,0) + 1')->where('id = ' . $rowid);
$db->setQuery($query);
$db->execute();
}
}
my problem : If the user reload the page , the hitcount value will be increase by 1, so the user can increase number of visits 100 , if he reload the page 100 times.
Could you give me hints How do I prevent the user from that ,so that is calculated by a single visit to the user no matter how he reload the page .
thank you