PHP Web Host - Quality Web Hosting For All PHP Applications Sign up for PayPal and start accepting credit card payments instantly
  Login or Register
 • Home • Downloads • Your Account • Forums • 

View next topic
View previous topic


Google
 
Web RavenPHPScripts (This Site)
Post new topic   Reply to topic
Author Message
BobMarion
Site Admin


Joined: Oct 30, 2002
Posts: 1039
Location: RedNeck Land (known as Kentucky)

PostPosted: Mon Aug 22, 2005 1:35 pm Reply with quote Back to top

This function was introduced in NukeSentinel(tm) 2.2.0 as a better method of importing the IP to Country data and to also allow admins to block out entire countries. This graphic overview covers Import to IP2Country

Image

Image

Image

Image

Image

Image

Image

Image

Image

Import to Blocked Ranges follows the same basic steps except that you only click on hte countries you want to block out not all countries.
View user's profile Send private message Send e-mail Visit poster's website
goatherder
New Member
New Member


Joined: May 09, 2006
Posts: 1

PostPosted: Tue May 09, 2006 2:53 pm Reply with quote Back to top

Hi,

Sorry for posting in a sticky but is there a way to import ALL ip2country tables rather than click on one at a time?

Thanks.
View user's profile Send private message
macpo80
New Member
New Member


Joined: May 26, 2006
Posts: 3

PostPosted: Mon May 29, 2006 12:27 pm Reply with quote Back to top

wow i wished i never touched this now i have 39 pages of canada to unblock.... sheesh
View user's profile Send private message
gregexp
The Mouse Is Extension Of Arm


Joined: Feb 21, 2006
Posts: 1472
Location: In front of a screen....HELP! lol

PostPosted: Mon May 29, 2006 10:09 pm Reply with quote Back to top

could u explain why u have to unblock 39 pages od canada?
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger MSN Messenger ICQ Number
montego
Moderator


Joined: Aug 29, 2004
Posts: 7487
Location: Arizona

PostPosted: Tue May 30, 2006 6:06 am Reply with quote Back to top

Sounds like he imported into "BLocked Ranges" instead of "IP2Country".

Smack
View user's profile Send private message Visit poster's website
evaders99
Moderator


Joined: Apr 30, 2004
Posts: 2856

PostPosted: Sun Aug 13, 2006 3:55 am Reply with quote Back to top

Someone was asking for an IMPORT ALL function.. and so was I. So I took the attempt to write one. Seems to work quite well... but it may not be Sentinel standard code formating. Sorry, if Bob Marion wants to add it - he can Smile

Code:

in admin/modules/nukesentinel/ABImportIP2Country.php


FIND


}
echo "$importmess<br>\n";


REPLACE WITH

  echo "$importmess<br>\n";
} elseif (isset($importall) AND ($importall == 1)) {
  $handle=opendir("import");
  while($file = readdir($handle)) {
    if($file != "." and $file != ".." AND !stristr($file, ".ht")) {
      $file = str_replace(".data", "", $file);
      $importlist .= "$file ";
    }
  }
  closedir($handle);
  $importlist = explode(" ", $importlist);
  sort($importlist);
  for($i=0; $i < sizeof($importlist); $i++) {
    if($importlist[$i]!="") {
      $importer = $importlist[$i];
      if($importer>"") { echo "<center class='title'><b>".str_replace("_", " ", $importer)." "._AB_ADDED."!</b></center><br />\n"; }
     // Read and import Country Data
     $import_data = @file("import/".$importer.".data");
     $import_data = implode($import_data);
     if(!$import_data OR $import_data == "") {
       echo "<center><b>"._AB_UNAVAILABLE."</b></center>\n";
     } else {
       $import_data - str_replace("\r", "", $import_data);
       $import_data = explode("\n", $import_data);
       $import_count = count($import_data);
       $importmess = _AB_EVERYTHINGSUCCEESFULLY."<br>\n";
       for($j=0; $j<$import_count; $j++) {
         $import_data[$j] = trim($import_data[$j]);
         if($import_data[$j] > "") {
           $grabline = explode("||", $import_data[$j]);
           list($grabline[4]) = $db->sql_fetchrow($db->sql_query("SELECT `country` FROM `".$prefix."_nsnst_countries` WHERE `c2c`='".$grabline[3]."'"));
           if($grabline[0] == "--") {
             $db->sql_query("DELETE FROM `".$prefix."_nsnst_ip2country` WHERE `c2c`='".$grabline[3]."'");
             $db->sql_query("OPTIMIZE TABLE `".$prefix."_nsnst_ip2country`");
           } else {
             if(!get_magic_quotes_runtime()) { $grabline[4] = addslashes($grabline[4]); }
             $grabline[ip_lo] = long2ip($grabline[0]);
             $grabline[ip_hi] = long2ip($grabline[1]);
             $datainserted = False;
             $datainserted = $db->sql_query("INSERT INTO `".$prefix."_nsnst_ip2country` VALUES('$grabline[0]', '$grabline[1]', '$grabline[2]', '$grabline[3]', '$grabline[4]')");
             if(!$datainserted) {
               echo "<b>$grabline[ip_lo] - $grabline[ip_hi] "._AB_NOTINSERTED." ".$prefix."_nsnst_ip2country</b><br>\n";
               $importmess = "";
             }
           }
         }
       }
     }     
     echo "$importmess<br>\n";    
    }
  }
}
echo "<center><form action='".$admin_file.".php?op=ABImportIP2Country' method='post'>\n";
echo "<input type='hidden' name='importall' value='1'>";
echo "<input type='submit' value='"._AB_IMPORTDATA." ALL'>";
echo "</form></center>";



This will add a new button that reads "Import Data All" - it may take some time to process depending on how well your server handles that many queries.
View user's profile Send private message Visit poster's website
evaders99
Moderator


Joined: Apr 30, 2004
Posts: 2856

PostPosted: Mon Aug 14, 2006 9:41 am Reply with quote Back to top

For servers that timeout during the whole thing, I've done a Javasc ript hack to automatically go through the list. It will save having to click each country manually.

This hack will change the functionality though - automatically going to the next in the list and submitting it. To stop the process, you will need to click out of that page. You could add a delay or a perhaps even a better run/stop button. But this is a basic basic hack

Code:

in admin/modules/nukesentinel/functions.php

FIND

  echo "<center><form action='".$admin_file.".php?op=".$xop."' method='post'>\n";

REPLACE WITH

  echo "<center><form name='myform' action='".$admin_file.".php?op=".$xop."' method='post'>\n";

FIND

  for($i=0; $i < sizeof($importlist); $i++) {

BEFORE, ADD

  $selectflag = 0;

FIND

      if($importlist[$i]==$importer) { echo " selected"; }

REPLACE WITH

      if($selectflag == 1) { echo " selected"; $selectflag = 0; }
      if($importlist[$i]==$importer) { $selectflag = 1; }

FIND

  echo "</form></center>";

AFTER, ADD

  if ($importer>"") {
     echo "<sc ript language=\"JavaSc ript\">\n";
     echo "document.myform.submit();\n";
     echo "</sc ript>\n";
  }


Note that all "sc ript" with the spaces need to remove the space.
View user's profile Send private message Visit poster's website
montego
Moderator


Joined: Aug 29, 2004
Posts: 7487
Location: Arizona

PostPosted: Mon Aug 14, 2006 7:22 pm Reply with quote Back to top

Yeah, I've been considering doing something with BigDump (or writing my own) and some additional PHP script to do this all in one shot outside of NS.... have only gotten to the "thinking stage" of development... Smile
View user's profile Send private message Visit poster's website
evaders99
Moderator


Joined: Apr 30, 2004
Posts: 2856

PostPosted: Tue Aug 15, 2006 2:48 am Reply with quote Back to top

Probably SQL files may be faster, as it doesn't have to process the import files themselves. That's also a good thought for a seperate installer
View user's profile Send private message Visit poster's website
BobMarion
Site Admin


Joined: Oct 30, 2002
Posts: 1039
Location: RedNeck Land (known as Kentucky)

PostPosted: Thu Aug 17, 2006 9:43 pm Reply with quote Back to top

As long as you have no issue with it I will add this to 2.5.03 Smile

evaders99 wrote:
For servers that timeout during the whole thing, I've done a Javasc ript hack to automatically go through the list. It will save having to click each country manually.

This hack will change the functionality though - automatically going to the next in the list and submitting it. To stop the process, you will need to click out of that page. You could add a delay or a perhaps even a better run/stop button. But this is a basic basic hack

Code:

in admin/modules/nukesentinel/functions.php

FIND

  echo "<center><form action='".$admin_file.".php?op=".$xop."' method='post'>\n";

REPLACE WITH

  echo "<center><form name='myform' action='".$admin_file.".php?op=".$xop."' method='post'>\n";

FIND

  for($i=0; $i < sizeof($importlist); $i++) {

BEFORE, ADD

  $selectflag = 0;

FIND

      if($importlist[$i]==$importer) { echo " selected"; }

REPLACE WITH

      if($selectflag == 1) { echo " selected"; $selectflag = 0; }
      if($importlist[$i]==$importer) { $selectflag = 1; }

FIND

  echo "</form></center>";

AFTER, ADD

  if ($importer>"") {
     echo "<sc ript language=\"JavaSc ript\">\n";
     echo "document.myform.submit();\n";
     echo "</sc ript>\n";
  }


Note that all "sc ript" with the spaces need to remove the space.
View user's profile Send private message Send e-mail Visit poster's website
evaders99
Moderator


Joined: Apr 30, 2004
Posts: 2856

PostPosted: Sat Aug 19, 2006 2:23 am Reply with quote Back to top

Sure I don't mind. Better, if you want to enhance it with anything I've suggested go ahead Smile

(Weird the quick reply is setting off Sentinel, but the Post Reply works fine)
View user's profile Send private message Visit poster's website
jay99
New Member
New Member


Joined: Jul 08, 2006
Posts: 14

PostPosted: Mon Oct 09, 2006 10:58 am Reply with quote Back to top

Ok, but in this sticky, where is it listed where to upload the new IP to Country data?

I put it in various places inventing nifty names like "Import" or Import folder, data but it always returns Data file is unavailable or is empty.

I chmod everything also...

I only post after 3 solid hours of searching.

Thanks in advance.
View user's profile Send private message
evaders99
Moderator


Joined: Apr 30, 2004
Posts: 2856

PostPosted: Mon Oct 09, 2006 11:03 am Reply with quote Back to top

The folder named "import" - it is off the phpNuke root folder
View user's profile Send private message Visit poster's website
montego
Moderator


Joined: Aug 29, 2004
Posts: 7487
Location: Arizona

PostPosted: Mon Oct 09, 2006 9:08 pm Reply with quote Back to top

It should also say the same in the installation readme. Wink

Quote:

Uploading Files:
----------------
NukeSentinel(tm) Files in Directories: FTP Upload to:
html/import/*.* ----------------> root/import/*.* See IMPORT.txt for info.
* root = the root directory of your site.
View user's profile Send private message Visit poster's website
Display posts from previous:       
Post new topic   Reply to topic

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
Forums ©
 

All logos and trademarks in this site are property of their respective owner.
The comments are property of their posters, all the rest © 2002-2008 by Raven
Proud to be listed at Lobo Links Web Directory

You can syndicate our news using the file xml

CSE HTML Validator Helped Clean up This Page! [Valid RSS] valid RSS 2.0 Valid robots.txt Stop Spam Harvesters, Join Project Honey Pot

Website engines core code is © copyright by PHP-Nuke but has been heavily patched and modified by myself and others.
PHP-Nuke is a free software released under the GNU/GPL.


:: fisubice phpbb2 style by Daz :: PHP-Nuke theme by www.nukemods.com ::

:: fisubice Theme Recoded To 100% W3C CSS & HTML 4.01 Transitional Compliance by Raven and 64bitguy ::

:: W3C CSS Compliance Validation :: W3C HTML 4.01 Transitional Compliance Validation ::

zerosum