I need to track users as the browse my site. The session does not need to last any longer after they close the browser. I figured to start a session and simply track the $phpsessid. I can not make it work. I just need to keep track of the current page and total number of pages.. thanks in advance folks!
-satch
<?
IF(!$PHPSESSID){
session_start();
$result = MYSQL_QUERY("INSERT INTO visitors (session,page_on,num_pages) VALUES ('$PHPSESSID','$PHP_SELF','1')");
}ELSE{
$result = MYSQL_QUERY("SELECT * FROM visitors WHERE session = '$PHPSESSID'");
$row = MYSQL_FETCH_ARRAY($result);
$updated_num_pages = $row[num_pages]+1;
$update = MYSQL_QUERY("UPDATE visitors SET page_on = '$PHP_SELF', num_pages = '$updated_num_pages' WHERE session = $PHPSESSID");
}
?>