[FIX] Use existing memcache instance for AntiDOS
This commit is contained in:
parent
1d6a560dd7
commit
23eed77ebe
@ -17,6 +17,7 @@ require_once(INCLUDE_DIR . '/config/error_codes.inc.php');
|
|||||||
require_once(CLASS_DIR . '/base.class.php');
|
require_once(CLASS_DIR . '/base.class.php');
|
||||||
require_once(CLASS_DIR . '/coins/coin_base.class.php');
|
require_once(CLASS_DIR . '/coins/coin_base.class.php');
|
||||||
require_once(CLASS_DIR . '/setting.class.php');
|
require_once(CLASS_DIR . '/setting.class.php');
|
||||||
|
if (PHP_OS == 'WINNT') require_once(CLASS_DIR . '/memcached.class.php');
|
||||||
|
|
||||||
// Now decide on which coin class to load and instantiate
|
// Now decide on which coin class to load and instantiate
|
||||||
if (file_exists(CLASS_DIR . '/coins/coin_' . $config['algorithm'] . '.class.php')) {
|
if (file_exists(CLASS_DIR . '/coins/coin_' . $config['algorithm'] . '.class.php')) {
|
||||||
|
|||||||
@ -43,14 +43,8 @@ include_once('include/bootstrap.php');
|
|||||||
$hts = ($config['https_only'] && (!empty($_SERVER['QUERY_STRING']))) ? "https://".$_SERVER['SERVER_NAME'].$_SERVER['SCRIPT_NAME']."?".$_SERVER['QUERY_STRING'] : "https://".$_SERVER['SERVER_NAME'].$_SERVER['SCRIPT_NAME'];
|
$hts = ($config['https_only'] && (!empty($_SERVER['QUERY_STRING']))) ? "https://".$_SERVER['SERVER_NAME'].$_SERVER['SCRIPT_NAME']."?".$_SERVER['QUERY_STRING'] : "https://".$_SERVER['SERVER_NAME'].$_SERVER['SCRIPT_NAME'];
|
||||||
($config['https_only'] && @!$_SERVER['HTTPS']) ? exit(header("Location: ".$hts)):0;
|
($config['https_only'] && @!$_SERVER['HTTPS']) ? exit(header("Location: ".$hts)):0;
|
||||||
|
|
||||||
// Rate limiting
|
// Rate limiting, we use our initilized memcache from bootstrap/autoloader
|
||||||
if ($config['memcache']['enabled'] && $config['mc_antidos']['enabled']) {
|
if ($config['memcache']['enabled'] && $config['mc_antidos']['enabled']) {
|
||||||
if (PHP_OS == 'WINNT') {
|
|
||||||
require_once(CLASS_DIR . '/memcached.class.php');
|
|
||||||
}
|
|
||||||
// memcache antidos needs a memcache handle
|
|
||||||
$memcache = new Memcached();
|
|
||||||
$memcache->addServer($config['memcache']['host'], $config['memcache']['port']);
|
|
||||||
require_once(CLASS_DIR . '/memcache_ad.class.php');
|
require_once(CLASS_DIR . '/memcache_ad.class.php');
|
||||||
$skip_check = false;
|
$skip_check = false;
|
||||||
// if this is an api call we need to be careful not to time them out for those calls separately
|
// if this is an api call we need to be careful not to time them out for those calls separately
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user