Author |
Message |
BobMarion
Former Admin in Good Standing
![](modules/Forums/images/avatars/4a8223e348325d1641ec3.png)
Joined: Oct 30, 2002
Posts: 1037
Location: RedNeck Land (known as Kentucky)
|
Posted:
Mon Aug 22, 2005 1:35 pm |
|
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
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. |
_________________ Bob Marion
Codito Ergo Sum
Only registered users can see links on this board! Get registered or login! |
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
goatherder
New Member
![New Member New Member](modules/Forums/images/ranks/1star.gif)
![](modules/Forums/images/avatars/gallery/blank.gif)
Joined: May 09, 2006
Posts: 1
|
Posted:
Tue May 09, 2006 2:53 pm |
|
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. |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
macpo80
New Member
![New Member New Member](modules/Forums/images/ranks/1star.gif)
![](modules/Forums/images/avatars/gallery/blank.gif)
Joined: May 26, 2006
Posts: 3
|
Posted:
Mon May 29, 2006 12:27 pm |
|
wow i wished i never touched this now i have 39 pages of canada to unblock.... sheesh |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
gregexp
The Mouse Is Extension Of Arm
![](modules/Forums/images/avatars/458c161744a70db912a6e.jpg)
Joined: Feb 21, 2006
Posts: 1497
Location: In front of a screen....HELP! lol
|
Posted:
Mon May 29, 2006 10:09 pm |
|
could u explain why u have to unblock 39 pages od canada? |
_________________ For those who stand shall NEVER fall and those who fall shall RISE once more!! |
|
![ICQ Number ICQ Number](themes/RavenIce/forums/images/lang_english/icon_icq_add.gif) |
![](themes/RavenIce/forums/images/spacer.gif) |
montego
Site Admin
![](modules/Forums/images/avatars/0c0adf824792d6d341ef4.gif)
Joined: Aug 29, 2004
Posts: 9457
Location: Arizona
|
Posted:
Tue May 30, 2006 6:06 am |
|
Sounds like he imported into "BLocked Ranges" instead of "IP2Country".
![Smack](modules/Forums/images/smiles/smack.gif) |
_________________ Only registered users can see links on this board! Get registered or login!
Only registered users can see links on this board! Get registered or login! |
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
evaders99
Former Moderator in Good Standing
![](modules/Forums/images/avatars/803d73f6452557b947721.jpg)
Joined: Apr 30, 2004
Posts: 3221
|
Posted:
Sun Aug 13, 2006 3:55 am |
|
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
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. |
_________________ - Only registered users can see links on this board! Get registered or login! -
Need help? Only registered users can see links on this board! Get registered or login! |
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
evaders99
![](modules/Forums/images/avatars/gallery/blank.gif)
|
Posted:
Mon Aug 14, 2006 9:41 am |
|
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. |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
montego
![](modules/Forums/images/avatars/gallery/blank.gif)
|
Posted:
Mon Aug 14, 2006 7:22 pm |
|
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](modules/Forums/images/smiles/icon_smile.gif) |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
evaders99
![](modules/Forums/images/avatars/gallery/blank.gif)
|
Posted:
Tue Aug 15, 2006 2:48 am |
|
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 |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
BobMarion
![](modules/Forums/images/avatars/gallery/blank.gif)
|
Posted:
Thu Aug 17, 2006 9:43 pm |
|
As long as you have no issue with it I will add this to 2.5.03
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. |
|
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
evaders99
![](modules/Forums/images/avatars/gallery/blank.gif)
|
Posted:
Sat Aug 19, 2006 2:23 am |
|
Sure I don't mind. Better, if you want to enhance it with anything I've suggested go ahead
(Weird the quick reply is setting off Sentinel, but the Post Reply works fine) |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
jay99
New Member
![New Member New Member](modules/Forums/images/ranks/1star.gif)
![](modules/Forums/images/avatars/gallery/blank.gif)
Joined: Jul 08, 2006
Posts: 14
|
Posted:
Mon Oct 09, 2006 10:58 am |
|
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. |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
evaders99
![](modules/Forums/images/avatars/gallery/blank.gif)
|
Posted:
Mon Oct 09, 2006 11:03 am |
|
The folder named "import" - it is off the phpNuke root folder |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
montego
![](modules/Forums/images/avatars/gallery/blank.gif)
|
Posted:
Mon Oct 09, 2006 9:08 pm |
|
It should also say the same in the installation readme.
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.
|
|
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
|