<?php
/* --------------------------------------------------------------
GMTracker.php 2008-07-29 gambio
Gambio OHG
http://www.gambio.de
Copyright (c) 2008 Gambio OHG
Released under the GNU General Public License (Version 2)
[http://www.gnu.org/licenses/gpl-2.0.html]
--------------------------------------------------------------
GMTracker.php 09.04.2008 pt
Gambio OHG
http://www.gambio.de
Copyright (c) 2008 Gambio OHG
Released under the GNU General Public License (Version 2)
[http://www.gnu.org/licenses/gpl-2.0.html]
--------------------------------------------------------------
*/
class GMTracker {
var $gm_current_ip;
var $type;
var $timeout;
var $tryout;
var $timeline;
function GMTracker($type="login") {
$this->type = $type;
$conf = gm_get_conf(array('GM_' . strtoupper($this->type) . '_TIMEOUT','GM_' . strtoupper($this->type) . '_TRYOUT', 'GM_' . strtoupper($this->type) . '_TIMELINE'));
$this->gm_current_ip = $_SERVER['REMOTE_ADDR'];
$this->timeout = $conf['GM_' . strtoupper($this->type) . '_TIMEOUT'];
$this->tryout = $conf['GM_' . strtoupper($this->type) . '_TRYOUT'];
$this->timeline = $conf['GM_' . strtoupper($this->type) . '_TIMELINE'];
return;
}
/*
* -> log failed logins
*/
function gm_track() {
xtc_db_query("
INSERT INTO
gm_" . $this->type . "_history
SET
gm_" . $this->type . "_ip = '" . $_SERVER['REMOTE_ADDR'] . "',
gm_" . $this->type . "_date = NOW()
");
return;
}
/*
* -> delete ips
*/
function gm_delete_ip() {
xtc_db_query("
DELETE
FROM
gm_" . $this->type . "_history
WHERE
gm_" . $this->type . "_ip = '" . $this->gm_current_ip . "'
");
}
/*
* -> get date
*/
function gm_date($sort) {
$gm_query = xtc_db_query("
SELECT
unix_timestamp(gm_" . $this->type . "_date)
AS
gm_" . $this->type . "_date
FROM
gm_" . $this->type . "_history
WHERE
gm_" . $this->type . "_ip = '" . $this->gm_current_ip . "'
ORDER BY
gm_" . $this->type . "_date " . $sort . "
LIMIT 1
");
$gm_row = xtc_db_fetch_array($gm_query);
return $gm_row['gm_' . $this->type . '_date'];
}
/*
* -> count ip
*/
function gm_count() {
$first_date = $this->gm_date("ASC");
if(!empty($first_date)) {
$gm_query = xtc_db_query("
SELECT
count(gm_" . $this->type . "_ip)
AS
count
FROM
gm_" . $this->type . "_history
WHERE
gm_" . $this->type . "_ip = '" . $this->gm_current_ip . "'
AND
unix_timestamp(gm_" . $this->type . "_date) BETWEEN " . $first_date . " AND " . ($first_date + $this->timeline) . "
");
$gm_row = xtc_db_fetch_array($gm_query);
}
return $gm_row['count'];
}
/*
* -> get blocked ips
*/
function gm_ban() {
if($this->gm_count() >= $this->tryout) {
return true;
} else {
return false;
}
}
/*
* -> delete old ips
*/
function gm_delete($success = false) {
if($success == false) {
if(($this->gm_date('DESC')) + $this->timeout <= time()) {
$this->gm_delete_ip();
}
} else {
$this->gm_delete_ip();
}
return;
}
}
?>| nama | waktu | ukuran | owner | perm | aksi |
|---|---|---|---|---|---|
| .. | |||||
| csstidy/ | 2013-11-12 21:03 | 125.89 KB | 76129f60960:kunden | dxwrx-rx-r | |
| lib/ | 2013-11-12 21:03 | 601.96 KB | 76129f60960:kunden | dxwrx-rx-r | |
| ErrorHandler.php | 2013-11-12 21:03 | 10.34 KB | 76129f60960:kunden | -xw-x----- | |
| FileLog.php | 2013-11-12 21:02 | 2.93 KB | 76129f60960:kunden | -xw-x----- | |
| GMAltText.php | 2013-11-12 21:03 | 2.94 KB | 76129f60960:kunden | -xw-x----- | |
| GMAttributesCalculator.php | 2013-11-12 21:03 | 4.65 KB | 76129f60960:kunden | -xw-x----- | |
| GMCSSMonitor.php | 2013-11-12 21:03 | 13.19 KB | 76129f60960:kunden | -xw-x----- | |
| GMCSSOptimizer.php | 2013-11-12 21:03 | 32.87 KB | 76129f60960:kunden | -xw-x----- | |
| GMCat.php | 2013-11-12 21:03 | 9.08 KB | 76129f60960:kunden | -xw-x----- | |
| GMCounter.php | 2013-11-12 21:03 | 17.05 KB | 76129f60960:kunden | -xw-x----- | |
| GMEbay.php | 2013-11-12 21:02 | 9.16 KB | 76129f60960:kunden | -xw-x----- | |
| GMGMotion.php | 2013-11-12 21:02 | 24.31 KB | 76129f60960:kunden | -xw-x----- | |
| GMGPrintCartManager.php | 2013-11-12 21:03 | 14.66 KB | 76129f60960:kunden | -xw-x----- | |
| GMGPrintConfiguration.php | 2013-11-12 21:03 | 2.17 KB | 76129f60960:kunden | -xw-x----- | |
| GMGPrintContentManager.php | 2013-11-12 21:02 | 8.79 KB | 76129f60960:kunden | -xw-x----- | |
| GMGPrintElements.php | 2013-11-12 21:03 | 15.79 KB | 76129f60960:kunden | -xw-x----- | |
| GMGPrintFileManager.php | 2013-11-12 21:02 | 6.06 KB | 76129f60960:kunden | -xw-x----- | |
| GMGPrintOrderElements.php | 2013-11-12 21:03 | 7.46 KB | 76129f60960:kunden | -xw-x----- | |
| GMGPrintOrderManager.php | 2013-11-12 21:03 | 6.27 KB | 76129f60960:kunden | -xw-x----- | |
| GMGPrintOrderSurfaces.php | 2013-11-12 21:03 | 6.41 KB | 76129f60960:kunden | -xw-x----- | |
| GMGPrintOrderSurfacesManager.php | 2013-11-12 21:03 | 4.86 KB | 76129f60960:kunden | -xw-x----- | |
| GMGPrintProductManager.php | 2013-11-12 21:02 | 4.55 KB | 76129f60960:kunden | -xw-x----- | |
| GMGPrintSurfaces.php | 2013-11-12 21:03 | 9.99 KB | 76129f60960:kunden | -xw-x----- | |
| GMGPrintSurfacesGroupsManager.php | 2013-11-12 21:03 | 1.96 KB | 76129f60960:kunden | -xw-x----- | |
| GMGPrintSurfacesManager.php | 2013-11-12 21:03 | 9.62 KB | 76129f60960:kunden | -xw-x----- | |
| GMGPrintWishlistManager.php | 2013-11-12 21:03 | 14.81 KB | 76129f60960:kunden | -xw-x----- | |
| GMJSON.php | 2013-11-12 21:03 | 2.44 KB | 76129f60960:kunden | -xw-x----- | |
| GMJanolaw.php | 2013-11-12 21:03 | 3.76 KB | 76129f60960:kunden | -xw-x----- | |
| GMLangFileMaster.php | 2013-11-12 21:03 | 965 B | 76129f60960:kunden | -xw-x----- | |
| GMLightboxControl.php | 2013-11-12 21:03 | 691 B | 76129f60960:kunden | -xw-x----- | |
| GMLogoManager.php | 2013-11-12 21:03 | 6.78 KB | 76129f60960:kunden | -xw-x----- | |
| GMMeta.php | 2013-11-12 21:02 | 8.29 KB | 76129f60960:kunden | -xw-x----- | |
| GMProduct.php | 2013-11-12 21:03 | 2.37 KB | 76129f60960:kunden | -xw-x----- | |
| GMSEOBoost.php | 2013-11-12 21:03 | 25.63 KB | 76129f60960:kunden | -xw-x----- | |
| GMSitemap.php | 2013-11-12 21:03 | 5.32 KB | 76129f60960:kunden | -xw-x----- | |
| GMStatusbar.php | 2013-11-12 21:02 | 2.46 KB | 76129f60960:kunden | -xw-x----- | |
| GMTSWidget.php | 2013-11-12 21:03 | 4.93 KB | 76129f60960:kunden | -xw-x----- | |
| GMTabTokenizer.php | 2013-11-12 21:03 | 2.81 KB | 76129f60960:kunden | -xw-x----- | |
| GMTracker.php | 2013-11-12 21:03 | 3.49 KB | 76129f60960:kunden | -xw-x----- | |
| JSON.php | 2013-11-12 21:03 | 39.98 KB | 76129f60960:kunden | -xw-x----- | |
| application_top.php | 2013-11-12 21:03 | 34.02 KB | 76129f60960:kunden | -xw-x----- | |