Ravens PHP Scripts: Forums
 

 

View next topic
View previous topic
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> v2.4 RN Issues
Author Message
j4rdin
Worker
Worker



Joined: May 26, 2006
Posts: 153

PostPosted: Sat May 14, 2011 2:52 pm Reply with quote

I have just spent a number of hours trying to find out why I was banned from my website, both as a visitor and admin. I was banned both from my home PC work PC and mobile phone, so assume everyone was getting the same thing.

The page was displaying the following:

Error 403 - Forbidden etc. with an IP address shown that was not the one I was using. After spending ages switching out nuke via the database and checking for problems in bvoth database and htaccess files, etc. I finally realised the IP address shown was in the banned list so removed it. Can now get into the site again.

Does anyone know why the site would ban someone like this when the IP address was not the one they are using. It didn't make any difference if I accessed the site via pagewasher.

Thanks.
 
View user's profile Send private message
papamike
Theme Guru



Joined: Jan 11, 2006
Posts: 170

PostPosted: Tue Jun 07, 2011 10:09 pm Reply with quote

Here we go. I'm a Linux type of person and I upgraded a few things on my localhost today to include Raven Nuke. I am now being blocked from doing anything with RN. I have run my server for a long time and this is my first encounter with this script. Thanks for your help in advance. Smile

$ip = $_SERVER['REMOTE_ADDR'];
if(!ereg('^([0-9]{1,3})\\.([0-9]{1,3})\\.([0-9]{1,3})\\.([0-9]{1,3})$', $ip)) die('Nice try!!');
 
View user's profile Send private message
Palbin
Site Admin



Joined: Mar 30, 2006
Posts: 2583
Location: Pittsburgh, Pennsylvania

PostPosted: Wed Jun 08, 2011 4:45 am Reply with quote

Code:


<?php

/************************************************************************/
/* PHP-NUKE: Web Portal System                                          */
/* ===========================                                          */
/*                                                                      */
/* Copyright (c) 2004 by Francisco Burzi                                */
/* http://phpnuke.org                                                   */
/*                                                                      */
/* This program is free software. You can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 2 of the License.       */
/************************************************************************/

if (realpath(__FILE__) == realpath($_SERVER['SCRIPT_FILENAME'])) {
   header('Location: ../index.php');
   exit('Access Denied');
}

global $bypassNukeSentinelInvalidIPCheck, $db, $prefix;

$ip = $_SERVER['REMOTE_ADDR'];
$ipv4 = filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4);
$ipv6 = filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6);
if(!$ipv4 && (!$ipv6 && !$bypassNukeSentinelInvalidIPCheck)) die('Invalid IP Address!');

$numrow = $db->sql_numrows($db->sql_query('SELECT `id` FROM `' . $prefix . '_banned_ip` WHERE `ip_address`="' . $ip . '"'));
if ($numrow != 0) {
   echo '<br /><br /><center><img src="images/admin/ipban.gif" /><br /><br /><b>You have been banned by the administrator</b></center>';
   die();
}

if ($ipv4) {
   $ip_class = explode('.', $ip);
   $ip = $ip_class[0] . '.' . $ip_class[1] . '.' . $ip_class[2] . '.*';
   list($ip_address) = $db->sql_fetchrow($db->sql_query('SELECT `ip_address` FROM `' . $prefix . '_banned_ip` WHERE `ip_address`="' . $ip . '"'));
   $ip_class_banned = explode('.', $ip_address);
   if (isset($ip_class_banned[3]) && $ip_class_banned[3] == '*') {
      if ($ip_class[0] == $ip_class_banned[0] && $ip_class[1] == $ip_class_banned[1] && $ip_class[2] == $ip_class_banned[2]) {
         echo '<br /><br /><center><img src="images/admin/ipban.gif" /><br /><br /><b>You have been banned by the administrator</b></center>';
         die();
      }
   }
}

?>


_________________
"Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it." — Brian W. Kernighan. 
View user's profile Send private message
papamike







PostPosted: Wed Jun 08, 2011 2:18 pm Reply with quote

Thanks for your help Palbin. Smile
 
Display posts from previous:       
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> v2.4 RN Issues

View next topic
View previous topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Powered by phpBB © 2001-2007 phpBB Group
All times are GMT - 6 Hours
 
Forums ©