/** START DB CONFIG *************************************************************************************/
/* VDX config */
$sHost = "127.0.0.1" ;
$sUser = "frc";
$sPass = "ss0k9ah6" ;
$sDb = "frankcreton_nl_counter" ;
$db = mysql_connect("$sHost" , "$sUser" , "$sPass") or
die ("verbinding mislukt");
mysql_select_db($sDb, $db);
$db = mysql_connect("$sHost" , "$sUser" , "$sPass") or
die ("verbinding mislukt");
mysql_select_db($sDb, $db);
/** END DB CONFIG *************************************************************************************/
$ip = 'ip' ;
$date = date("Y-m-d") ;
$page = $name ;
$page_ID = $img ;
$add_hit_SQL = "INSERT INTO werk (date, ip, page, page_ID) VALUES (' " . $date . " ', ' " . $ip . " ', ' " . $page . " ', '" . $page_ID . "' ) " ;
$add_hit = mysql_query($add_hit_SQL);
?>
/** START DB CONFIG *************************************************************************************/
/* VDX config */
$sHost = "127.0.0.1" ;
$sUser = "frc";
$sPass = "ss0k9ah6" ;
$sDb = "frankcreton_nl_counter" ;
$db = mysql_connect("$sHost" , "$sUser" , "$sPass") or
die ("verbinding mislukt");
mysql_select_db($sDb, $db);
$db = mysql_connect("$sHost" , "$sUser" , "$sPass") or
die ("verbinding mislukt");
mysql_select_db($sDb, $db);
/** END DB CONFIG *************************************************************************************/
if($referrer[2]==''){
$referrer_name = 'favoriet' ;
} else {
$referrer_name = $referrer[2] ; }
$useragent = $_SERVER['HTTP_USER_AGENT'] ;
$ip = $_SERVER['REMOTE_ADDR'] ;
if($useragent=='google') {
$ip = 'google' ;
}
$date = date("Y-m-d") ;
$page = $content ;
$hits = 1 ;
$check_hit_SQL = "SELECT * FROM frankcreton WHERE ip=' " . $ip . " ' AND date=' " . $date . " ' AND page=' " . $page . " ' " ;
$check_hit = mysql_query($check_hit_SQL);
$results = mysql_num_rows($check_hit ) ;
if($results == 0) {
$add_hit_SQL = "INSERT INTO frankcreton (date, ip, page, hits, ref) VALUES (' " . $date . " ', ' " . $ip . " ', ' " . $page . " ', ' " . $hits . " ' , '" . $referrer_name . "' ) " ;
$add_hit = mysql_query($add_hit_SQL);
} else {
$check_hit_array = mysql_fetch_array($check_hit) ;
$counter_ID = $check_hit_array['counter_ID'] ;
$hits = $check_hit_array['hits'] + 1 ;
$update_hit_SQL = "UPDATE frankcreton SET hits=' " . $hits . " ' WHERE counter_ID=' " . $counter_ID ." ' " ;
$update_hit = mysql_query($update_hit_SQL);
}
?>