本文整理匯總了PHP中save_searchengine_keyword函數的典型用法代碼示例。如果您正苦於以下問題:PHP save_searchengine_keyword函數的具體用法?PHP save_searchengine_keyword怎麽用?PHP save_searchengine_keyword使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了save_searchengine_keyword函數的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: visit_stats
/**
* 統計訪問信息
*
* @access public
* @return void
*/
function visit_stats()
{
if (C('visit_stats') == 'off') {
return;
}
$time = gmtime();
/* 檢查客戶端是否存在訪問統計的cookie */
$visit_times = !empty($_COOKIE['ECS']['visit_times']) ? intval($_COOKIE['ECS']['visit_times']) + 1 : 1;
setcookie('ECS[visit_times]', $visit_times, $time + 86400 * 365, '/');
$browser = get_user_browser();
$os = get_os();
$ip = real_ip();
$area = ecs_geoip($ip);
/* 語言 */
if (!empty($_SERVER['HTTP_ACCEPT_LANGUAGE'])) {
$pos = strpos($_SERVER['HTTP_ACCEPT_LANGUAGE'], ';');
$lang = addslashes($pos !== false ? substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, $pos) : $_SERVER['HTTP_ACCEPT_LANGUAGE']);
} else {
$lang = '';
}
/* 來源 */
if (!empty($_SERVER['HTTP_REFERER']) && strlen($_SERVER['HTTP_REFERER']) > 9) {
$pos = strpos($_SERVER['HTTP_REFERER'], '/', 9);
if ($pos !== false) {
$domain = substr($_SERVER['HTTP_REFERER'], 0, $pos);
$path = substr($_SERVER['HTTP_REFERER'], $pos);
/* 來源關鍵字 */
if (!empty($domain) && !empty($path)) {
save_searchengine_keyword($domain, $path);
}
} else {
$domain = $path = '';
}
} else {
$domain = $path = '';
}
$sql = 'INSERT INTO ' . $this->pre . 'stats ( ' . 'ip_address, visit_times, browser, system, language, area, ' . 'referer_domain, referer_path, access_url, access_time' . ') VALUES (' . "'{$ip}', '{$visit_times}', '{$browser}', '{$os}', '{$lang}', '{$area}', " . "'" . addslashes($domain) . "', '" . addslashes($path) . "', '" . addslashes(PHP_SELF) . "', '" . $time . "')";
$this->query($sql);
}
示例2: visit_stats
/**
* 統計訪問信息
*
* @access public
* @return void
*/
function visit_stats()
{
if (isset($GLOBALS['_CFG']['visit_stats']) && $GLOBALS['_CFG']['visit_stats'] == 'off')
{
return;
}
$time = gmtime();
/* 檢查客戶端是否存在訪問統計的cookie */
$visit_times = (!empty($_COOKIE['ECS']['visit_times'])) ? intval($_COOKIE['ECS']['visit_times']) + 1 : 1;
setcookie('ECS[visit_times]', $visit_times, $time + 86400 * 365, '/');
$browser = get_user_browser();
$os = get_os();
$ip = real_ip();
$area = ecs_geoip($ip);
/* 語言 */
if (!empty($_SERVER['HTTP_ACCEPT_LANGUAGE']))
{
$pos = strpos($_SERVER['HTTP_ACCEPT_LANGUAGE'], ';');
$lang = addslashes(($pos !== false) ? substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, $pos) : $_SERVER['HTTP_ACCEPT_LANGUAGE']);
}
else
{
$lang = '';
}
/* 來源 */
if (!empty($_SERVER['HTTP_REFERER']) && strlen($_SERVER['HTTP_REFERER']) > 9)
{
$pos = strpos($_SERVER['HTTP_REFERER'], '/', 9);
if ($pos !== false)
{
$domain = substr($_SERVER['HTTP_REFERER'], 0, $pos);
$path = substr($_SERVER['HTTP_REFERER'], $pos);
/* 來源關鍵字 */
if (!empty($domain) && !empty($path))
{
save_searchengine_keyword($domain, $path);
}
}
else
{
$domain = $path = '';
}
}
else
{
$domain = $path = '';
}
$sql = 'INSERT INTO ' . $GLOBALS['ecs']->table('stats') . ' ( ' .
'ip_address, visit_times, browser, system, language, area, ' .
'referer_domain, referer_path, access_url, access_time' .
') VALUES (' .
"'$ip', '$visit_times', '$browser', '$os', '$lang', '$area', ".
"'" . htmlspecialchars(addslashes($domain)) ."', '" . htmlspecialchars(addslashes($path)) ."', '" . htmlspecialchars(addslashes(PHP_SELF)) ."', '" . $time . "')";
$GLOBALS['db']->query($sql);
}