本文整理汇总了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);
}