I am trying to record the page details which the user is visiting and store them in the database. So, I wrote a function in a helper named hits_helper.php
which uses the current_url()
of codeigniter to do it.
function count_hits($options = array())
{
$CI =& get_instance();
$CI->load->library('user_agent');
$date = date('Y-m-j H:i:s', strtotime(date('Y-m-j H:i:s')) + 1214);
$data = array (
'page_Address' => current_url(),
'hit_Date' => $date
);
$CI->db->insert('counter', $data);
}
url helper is autoloaded.
It works and inserts the page url in the database, but it also inserts some urls like the favicon.ico and some css urls in the head section of the page respectively. What am I doing wrong?!