mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-12 23:31:44 +09:00
referer module (#279)
git-svn-id: http://xe-core.googlecode.com/svn/sandbox@3106 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
parent
74ad4fc4a7
commit
ae357bceb0
18 changed files with 384 additions and 0 deletions
60
modules/referer/referer.controller.php
Normal file
60
modules/referer/referer.controller.php
Normal file
|
|
@ -0,0 +1,60 @@
|
|||
<?php
|
||||
/**
|
||||
* @class refererController
|
||||
* @author haneul (haneul0318@gmail.com)
|
||||
* @brief referer 모듈의 controller class
|
||||
**/
|
||||
|
||||
class refererController extends referer {
|
||||
/**
|
||||
* @brief initialization
|
||||
**/
|
||||
function init() {
|
||||
}
|
||||
|
||||
function procRefererExecute() {
|
||||
if(empty($_SERVER["HTTP_REFERER"])) return;
|
||||
|
||||
// Log only from different hosts
|
||||
$referer = parse_url($_SERVER["HTTP_REFERER"]);
|
||||
if($referer['host'] == $_SERVER['HTTP_HOST']) return;
|
||||
|
||||
$oDB = &DB::getInstance();
|
||||
$oDB -> begin();
|
||||
$this->insertRefererLog($referer['host'], $_SERVER["HTTP_REFERER"]);
|
||||
$this->deleteOlddatedRefererLogs();
|
||||
$this->updateRefererStatistics($referer['host']);
|
||||
$oDB -> commit();
|
||||
}
|
||||
|
||||
function updateRefererStatistics($host)
|
||||
{
|
||||
$oRefererModel = &getModel('referer');
|
||||
$args->host = $host;
|
||||
if($oRefererModel->isInsertedHost($host))
|
||||
{
|
||||
$output = executeQuery('referer.updateRefererStatistics', $args);
|
||||
}
|
||||
else
|
||||
{
|
||||
$output = executeQuery('referer.insertRefererStatistics', $args);
|
||||
}
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
function insertRefererLog($host, $url)
|
||||
{
|
||||
$args->regdate = date("YmdHis");
|
||||
$args->host = $host;
|
||||
$args->url = $url;
|
||||
return executeQuery('referer.insertRefererLog', $args);
|
||||
}
|
||||
|
||||
function deleteOlddatedRefererLogs()
|
||||
{
|
||||
$args->regdate = date("YmdHis", strtotime("-1 week"));
|
||||
return executeQuery('referer.deleteOlddatedLogs', $args);
|
||||
}
|
||||
}
|
||||
?>
|
||||
Loading…
Add table
Add a link
Reference in a new issue