User:SQL/Unblocked TOR/Source

From Wikipedia, the free encyclopedia

<?php
include("SxWiki.php"); //Include framework
$url = 'http://en.wikipedia.org/w/'; //Set for the English Wikipedia
$sxLgTA = sxLogin("user", "password"); //Log in
$sxLgID = $sxLgTA[uid];
$sxLgT = $sxLgTA[token];
$maxlag = "85"; //Set maxlag to 85
$epm = setEPM(10); //set 10 edits per min.
 
$unblocked_tor = array();
$blocked_tor = array();
$indtor = file("editwiki.txt");
$out = "==Unblocked TOR Exit nodes that allow Wikipedia==\r\n";
foreach($indtor as $onetor) {
        $onetor = ltrim($onetor);
        $onetor = rtrim($onetor);
        $totaltor++;
        $isblocked = sxIsBlocked($onetor);
        if($isblocked != 0) {
                array_push($unblocked_tor, $onetor);       
                echo "!";
                $numublocked++;
        } else {
                array_push($blocked_tor, $onetor); 
                echo ".";
                $numblocked++;
        }
}
#echo "$numblocked blocked, $numublocked not blocked\n";
foreach ($unblocked_tor as $utor_node) {
        $topage = $topage . '#{{IPvandal|' . $utor_node . '}}' . "\r\n";
}
foreach ($blocked_tor as $utor_node2) {
        $topage2 = $topage2 . '#{{IPvandal|' . $utor_node2 . '}}' . "\r\n";
}
 
$publocked = $numublocked / $totaltor;
$publocked = $publocked * 100;
$publocked = round($publocked, 2);
$publocked = $publocked . '%';
$tstats = "\n*Unblocked tor nodes: $numublocked\n*Blocked tor nodes: $numblocked\n*Percent unblocked: $publocked\n";
$topage = "*Source Code: [[User:SQL/Unblocked TOR/Source]]\r\n{{quote|::Btw, those tor nodes don't necessarily *need* blocking. They're all exit nodes (to the best of my ability to figure that out), and, all allow wiki editing. I meant the list for statistical use only, not as a block-checklist... |SQL}}\r\n==Statistics==\r\n" . $tstats . "==Unblocked==\r\n" . $topage . "==Blocked==\r\n" . $topage2; 
sxPutPage("User:SQL/Unblocked_TOR", "Posting list of unblocked tor nodes using [[User:SQL/SxWiki|SxWiki]]", $topage, 
$null);
?>