當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Tracking::parse_user_agent方法代碼示例

本文整理匯總了PHP中Tracking::parse_user_agent方法的典型用法代碼示例。如果您正苦於以下問題:PHP Tracking::parse_user_agent方法的具體用法?PHP Tracking::parse_user_agent怎麽用?PHP Tracking::parse_user_agent使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Tracking的用法示例。


在下文中一共展示了Tracking::parse_user_agent方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: track

 static function track($server, $cache_hash, $ref)
 {
     $db = mysql_connect(DB_HOST, DB_USER, DB_PASSWORD);
     mysql_select_db(DB_DATABASE, $db);
     mysql_query("SET NAMES utf8");
     $page_url = Tracking::get_page_url();
     $ip_address = Tracking::get_client_ip();
     $user_agent = Tracking::get_user_agent();
     $ua = Tracking::parse_user_agent();
     $ua["browser"] = empty($ua["browser"]) ? "n/a" : $ua["browser"];
     $ua["version"] = empty($ua["version"]) ? "n/a" : $ua["version"];
     $ua["platform"] = empty($ua["platform"]) ? "n/a" : $ua["platform"];
     $current_url = $ref == 1 ? Tracking::parse_location($server["HTTP_REFERER"]) : Tracking::parse_location("http://" . $server["HTTP_HOST"] . $server["REQUEST_URI"]);
     $utm_source = $current_url["utm_source"];
     $utm_medium = $current_url["utm_medium"];
     $utm_campaign = $current_url["utm_campaign"];
     $utm_content = $current_url["utm_content"];
     $utm_term = $current_url["utm_term"];
     $utm_id = $current_url["utm_id"];
     $gclid = $current_url["gclid"];
     $qry = '
   INSERT INTO
     tracking_visits
   VALUES
     (
      null,
      "' . mysql_real_escape_string($page_url) . '",
      "' . mysql_real_escape_string($ip_address) . '",
      "' . mysql_real_escape_string(Tracking::get_uid($server)) . '",
      "' . mysql_real_escape_string($user_agent) . '",
      "' . mysql_real_escape_string($ua["browser"]) . '",
      "' . mysql_real_escape_string($ua["version"]) . '",
      "' . mysql_real_escape_string($ua["platform"]) . '",
      "",
      "",
      "",
      "",
      "",
      "",
      "",
      "",
      "' . Tracking::get_user_language($_SERVER["HTTP_ACCEPT_LANGUAGE"]) . '",
      "' . mysql_real_escape_string($utm_source) . '",
      "' . mysql_real_escape_string($utm_medium) . '",
      "' . mysql_real_escape_string($utm_campaign) . '",
      "' . mysql_real_escape_string($utm_content) . '",
      "' . mysql_real_escape_string($utm_term) . '",
      "' . (int) $utm_id . '",
      "' . mysql_real_escape_string($gclid) . '",
      "' . (int) $cache_hash . '",
      null
      )
    ';
     mysql_query($qry);
     $id = mysql_insert_id();
     return $id;
 }
開發者ID:isavvala,項目名稱:cookieless,代碼行數:57,代碼來源:tracking.class.php


注:本文中的Tracking::parse_user_agent方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。