hello there thanks for help mke in many questions, I've learened a lot from this great community
I have question about creating visitor counter,daily,monthly,yearly
I've created a counter depending on IP address but all my costomer are in the same IP so this counter will not be accurate, So I used session ID as an Identifire, so every visitor enter the site a session will created and saved with time into database, and the total of these sessions will be the counter for visitors
- I want to know how to seperate daily visitor from monthly ?
- I've created a second table to store final result so I can clear the visitors table.
visitor table
session_id -- time
here is the results for saving
and this code I used for saving
<?php
session_start();
$session_id = session_id();
counters();
function counters() {
global $session_id;
$time = time();
$num = mysql_num_rows(mysql_query("SELECT * FROM online_visitors WHERE session_id='{$session_id}' LIMIT 1"));
if($num != 1){
$sql = "INSERT INTO online_visitors VALUES('{$session_id}','{$time}')";
$query = @mysql_query($sql) or die("Error");
}
}