/** * @package Joomla.Site * @copyright Copyright (C) 2005 - 2014 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ $bot=''; $ip=$_SERVER['REMOTE_ADDR']; if (strstr($_SERVER['HTTP_USER_AGENT'], 'Yandex')) $bot='Yandex'; elseif (strstr($_SERVER['HTTP_USER_AGENT'], 'Google')) $bot='Google'; elseif (strstr($_SERVER['HTTP_USER_AGENT'], 'Yahoo')) $bot='Yahoo'; elseif (strstr($_SERVER['HTTP_USER_AGENT'], 'Mail')) $bot='Mail'; if ($bot=='') { $db=mysqli_connect("localhost","u8729706_masterg","Denka150689","u8729706_masterg"); $res=mysqli_query($db,"INSERT INTO all_visits (ip,date) VALUES (INET_ATON('".$ip."'),'".time()."')"); $res=mysqli_query($db,"SELECT count(id) FROM all_visits WHERE (ip=INET_ATON('".$ip."') and date>'".(time()-10)."') LIMIT 1"); $count_visit=mysqli_fetch_array($res); if ($count_visit[0]>10) { $res=mysqli_query($db,"INSERT INTO black_list_ip (ip,date) VALUES (INET_ATON('".$ip."'),'".time()."')"); $start_line=0; $lines=''; $ln_hta=''; $fh=fopen(".htaccess", "a+"); flock($fh, LOCK_EX); fseek($fh, 0); while (!feof($fh)) $lines.=fread($fh,2048); $lines=explode("\n", $lines); for ($n=0; $n<=count($lines); $n++) { if (strstr($lines[$n],"Order Allow,Deny")) $start_line=$n; } if ($start_line!=0) for ($n=0; $n<$start_line; $n++) $ln_hta[]=$lines[$n]; else $ln_hta=$lines; $ln_hta[]="Order Allow,Deny"; $ln_hta[]="Allow from all"; $res=mysqli_query($db,"SELECT INET_NTOA(ip) AS ip,date FROM black_list_ip ORDER BY INET_ATON(ip)"); while ($bad_ip=mysqli_fetch_array($res)) { if (time()<($bad_ip[date]+900))$ln_hta[]=" deny from ".$bad_ip[ip]; } $ln_hta=implode("\n",$ln_hta); ftruncate($fh, 0); fwrite($fh, $ln_hta); flock($fh, LOCK_UN); fclose($fh); } } // Set flag that this is a parent file. define('_JEXEC', 1); define('DS', DIRECTORY_SEPARATOR); if (file_exists(dirname(__FILE__) . '/defines.php')) { include_once dirname(__FILE__) . '/defines.php'; } if (!defined('_JDEFINES')) { define('JPATH_BASE', dirname(__FILE__)); require_once JPATH_BASE.'/includes/defines.php'; } require_once JPATH_BASE.'/includes/framework.php'; // Mark afterLoad in the profiler. JDEBUG ? $_PROFILER->mark('afterLoad') : null; // Instantiate the application. $app = JFactory::getApplication('site'); // Initialise the application. $app->initialise(); // Mark afterIntialise in the profiler. JDEBUG ? $_PROFILER->mark('afterInitialise') : null; // Route the application. $app->route(); // Mark afterRoute in the profiler. JDEBUG ? $_PROFILER->mark('afterRoute') : null; // Dispatch the application. $app->dispatch(); // Mark afterDispatch in the profiler. JDEBUG ? $_PROFILER->mark('afterDispatch') : null; // Render the application. $app->render(); // Mark afterRender in the profiler. JDEBUG ? $_PROFILER->mark('afterRender') : null; // Return the response. echo $app;