I have taken this from Torrentstrike, it seems to work but there is one small problem that is probably easy to fix.
this is the importpg.php file:
now the problem is when i run that it tells me:
Source: [url="http://mirror.thesynapse.org/phoenixlabs/lists/level1.php"]http://mirror.thesynapse.org/phoenixlabs/lists/level1.php[/url]
0 ranges imported, 11521 line(s) was discarded.
so as you can see the script works, but for some reason it will not import to the database. i adapted the script to TorrentTrader v2.03 as much as i could but i think there is something missing. [size=12px]so if somebody could please help!!!!!!!!![/size]
this is the importpg.php file:
<?
// This script downloads/adds/updates peerguardian IP ranges in the bans table.
require_once ("backend/functions.php");
dbconn();
header("Content-type: text/plain");
if (!$CURUSER || $CURUSER["class"]<"7")die;{
$url = "http://mirror.thesynapse.org/phoenixlabs/lists/level1.php";
$f = @fopen($url, "r");
if (!$f)
show_error_msg("Cannot download: " . htmlspecialchars($url));
mysql_query("DELETE FROM bans WHERE comment LIKE 'PeerGuardian: %'") or sqlerr(__FILE__, __LINE__);
$uid = $CURUSER["id"];
$n = 0;
$o = 0;
$dt = sqlesc(get_date_time());
while (!feof($f))
{
++$o;
$s = rtrim(fgets($f));
$i = strrpos($s, ":");
if (!$i) continue;
$comment = sqlesc("PeerGuardian: " . substr($s, 0, $i));
$s = substr($s, $i + 1);
$i = strpos($s, "-");
$first = ip2long(substr($s, 0, $i));
$last = ip2long(substr($s, $i + 1));
if ($first == -1 || $last == -1) continue;
mysql_query("INSERT INTO bans (added, addedby, comment, first, last) VALUES($dt, $uid, $comment, $first, $last )")or die(mysql_error());
$res = mysql_query($query) or sqlerr(__FILE__, __LINE__);
if (mysql_affected_rows() != 1)
show_error_msg("Database insertion failed (" . htmlspecialchars($query) . ").");
++$n;
}
$o -= $n;
print("Source: " . htmlspecialchars($url) . "\n$n ranges imported, $o line(s) was discarded.");
}
?>now the problem is when i run that it tells me:
Source: [url="http://mirror.thesynapse.org/phoenixlabs/lists/level1.php"]http://mirror.thesynapse.org/phoenixlabs/lists/level1.php[/url]
0 ranges imported, 11521 line(s) was discarded.
so as you can see the script works, but for some reason it will not import to the database. i adapted the script to TorrentTrader v2.03 as much as i could but i think there is something missing. [size=12px]so if somebody could please help!!!!!!!!![/size]