<?php


$url = !empty( $_GET['url'] ) ? trim( $_GET['url'] ) : "";
if ( empty( $url ) )
{
	exit( "1" );
}
require_once( "_inc.php" );
if ( !$gEnableClickIn )
{
	exit( "2" );
}
$arrParts = parse_url( $url );
$domain = $arrParts['host'];
if ( empty( $domain ) )
{
	exit( "3" );
}
session_start( );
if ( !empty( $_SESSION['ses_arrClickIn'] ) || in_array( $domain, $_SESSION['ses_arrClickIn'] ) )
{
	exit( "4" );
}
$GLOBALS['_SESSION']['ses_arrClickIn'][] = $domain;
require_once( $dRootDir."inc/classes/db.php" );
$db = new db( $gDb );
$sql = "UPDATE ".$gDb['prefix'].( "sites SET f_clickIn=f_clickIn+1, f_clickScore=f_clickIn-f_clickOut WHERE (f_url LIKE 'http://".$domain."%') ORDER BY f_id ASC LIMIT 1" );
$db->query( $sql );
exit( "5" );
?>
