vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   Redirect malicious page loads (https://vborg.vbsupport.ru/showthread.php?t=158705)

marto 09-25-2007 05:36 AM

Redirect malicious page loads
 
Is there a way to add this into the forum index.php??

<?
$gawd = array ("xxx.xxx.xxx.xxx", "xxx.xxx.xxx.xxx", "xxx.xxx.xxx.xxx");
foreach($gawd as $kill) {
if (ereg($kill, $_SERVER['REMOTE_ADDR'])) {
header('Location: http://www.ic3.gov');
exit();
} else {
LOAD FORUM INDEX HERE;
exit();
}
}

?>

I know I can ban them in the CP but this still uses resources to load the error page. Wouldn't something like this be less intensive.

maybe .htaccess would be a better way to go. I dunno what does anyone think?

Dismounted 09-25-2007 05:47 AM

PHP Code:

$banned = array("xxx.xxx.xxx.xxx""xxx.xxx.xxx.xxx""xxx.xxx.xxx.xxx");

if (
in_array($banned$_SERVER['REMOTE_ADDR']))
{
    
header('Location: http://www.ic3.gov/');


Place this in a plugin at the init_startup hook.

marto 09-25-2007 05:58 AM

wow that was fast. I did a htaccess on it with RewriteCond and Rewriterule. I got to thinking maybe it would be better in php then again maybe not since they could target something else to reload.

Thank you very much for the information

--------------- Added at 01:08 ---------------

Warning: in_array(): Wrong datatype for second argument in /includes/init.php(329) : eval()'d code on line 3

?? REMOTE_ADDR

my start up order is 1

Dismounted 09-25-2007 06:22 AM

PHP Code:

$banned = array("xxx.xxx.xxx.xxx""xxx.xxx.xxx.xxx""xxx.xxx.xxx.xxx");

if (
in_array($_SERVER['REMOTE_ADDR'], $banned))
{
    
header('Location: http://www.ic3.gov/');


Sorry, I had the variables the wrong way round.

marto 09-25-2007 06:34 AM

No problem. I'm dangerous enough to dabble as it is, it worked :) sweet.


All times are GMT. The time now is 11:11 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01093 seconds
  • Memory Usage 1,723KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (2)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (5)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete