Exemple #1
0
// クラスファイル読み込み
require_once "./Calculation.php";
// 計算オブジェクト精製
$calc = new Calculation($_REQUEST["access_key"]);
// リクエストで送ってきた日付の有効性をチェック
if (!$calc->isDate($_REQUEST["date"])) {
    echo "<?xml version=\"1.0\"?>";
    echo "<delyzer>";
    echo "<judge>false</judge>";
    echo "</delyzer>";
    exit;
}
//年月日時(例:2007091816)で渡って来ます
$check_date = $_REQUEST["date"];
//今月、前月、前々月の年月を取得
list($next_month_year, $next_month_month) = $calc->getMonthAgoDate($check_date, -1);
list($one_month_year, $one_month_month) = $calc->getMonthAgoDate($check_date, 0);
list($two_month_year, $two_month_month) = $calc->getMonthAgoDate($check_date, 1);
list($three_month_year, $three_month_month) = $calc->getMonthAgoDate($check_date, 2);
//print("next_month_year=".$next_month_year."<br>");
//print("next_month_month=".$next_month_month."<br>");
//print("one_month_year=".$one_month_year."<br>");
//print("one_month_month=".$one_month_month."<br>");
//print("two_month_year=".$two_month_year."<br>");
//print("two_month_month=".$two_month_month."<br>");
//print("three_month_year=".$three_month_year."<br>");
//print("three_month_month=".$three_month_month."<br>");
//トップページのアクセス数を取得
$access_sql = "SELECT media_cd AS ad_code, access_count AS access_count FROM media_analyze " . "WHERE analyze_datetime >= " . $check_date . "0000 AND analyze_datetime <= " . $check_date . "5959 " . "AND disable = 0 " . "GROUP BY ad_code";
//print("sql=".$access_sql."<br>");
$access_result = $calc->calcAccess($access_sql);