User:MichaelBillington/Count/Source

//  <?php echo file_get_contents("display/start.txt"); $wiki=$_GET['wiki']; $user=$_GET['name']; $count=$_GET['count']; if($user==){$count=;} if($wiki==){$count=;} if($count=='count'){ $fp = fsockopen($wiki.".org", 80, $errno, $errstr, 30); if (!$fp) { echo "$errstr ($errno) \n"; } else { $out = "GET /w/index.php?title=Special:Contributions&limit=50000&target=".$user." HTTP/1.1\r\n"; $out .= "Host: ".$wiki.".org\r\n"; $out .= "User-Agent: Mike's edit counter\r\n"; $out .= "Connection: Close\r\n\r\n"; fwrite($fp, $out); while (!feof($fp)) { //echo fgets($fp, 128); $b=fgets($fp, 128); $a=$a.$b; }     fclose($fp); $a=substr($a,0,strpos($a,'')); $alledits = explode("", $a); for($i = 1; $i < count($alledits); $i++) {       $totaledits++; $templ=substr($alledits[$i], strpos($alledits[$i],'?title=')); $namespace=substr($templ,0,strpos($templ,':')); switch($namespace){ case '?title=Wikipedia': $EditWP++; break; case '?title=Wikipedia_talk': $EditWT++; break; case '?title=Wikiversity': $EditWP++; break; case '?title=Wikiversity_talk': $EditWT++; break; case '?title=User': $EditU++; break; case '?title=User_talk': $EditUT++; break; case '?title=Image': $EditI++; break; case '?title=Image_talk': $EditIT++; break; case '?title=MediaWiki': $EditM++; break; case '?title=MediaWiki_talk': $EditMT++; break; case '?title=Template': $EditT++; break; case '?title=Template_talk': $EditTT++; break; case '?title=Help': $EditH++; break; case '?title=Help_talk': $EditHT++; break; case '?title=Category': $EditC++; break; case '?title=Category_talk': $EditCT++; break; case '?title=Talk': $EditTa++; break; case '?title=Portal': $EditPortal++; break; case '?title=Portal_talk': $EditPortalT++; break; case '?title=School': $EditSchool++; break; case '?title=School_talk': $EditSchoolT++; break; case '?title=Topic': $EditTopic++; break; case '?title=Topic_talk': $EditTopicT++; break; default: $EditMain++; break; }     }      if($totaledits==''){ echo "No edits found for ".$user." on ".$wiki."."; } else { echo "Edit count for ".$user." on ".$wiki.": "; echo " Total edits: "; echo $totaledits; //All if($EditMain!=''){ echo " Mainspace: "; echo $EditMain; //Main }       if($EditTa!=''){ echo " Talk: "; echo $EditTa; //Talk }       if($EditU!=''){ echo " User: "; echo $EditU; //User }       if($EditUT!=''){ echo " User talk: "; echo $EditUT; //User talk }       if($EditWP!=''){ echo " Project: "; echo $EditWP; //Wikipedia }       if($EditWT!=''){ echo " Project talk: "; echo $EditWT; //Wikipedia talk }       if($EditI!=''){ echo " Image: "; echo $EditI; //Image }       if($EditIT!=''){ echo " Image talk: "; echo $EditIT; //Image talk }       if($EditM!=''){ echo " MediaWiki: "; echo $EditM; //MediaWiki }       if($EditMT!=''){ echo " MediaWiki talk: "; echo $EditMT; //MediaWiki talk }       if($EditT!=''){ echo " Template: "; echo $EditT; //Template }       if($EditTT!=''){ echo " Template talk: "; echo $EditTT; //Template talk }        if($EditH!=''){ echo " Help: "; echo $EditH; //Help }       if($EditHT!=''){ echo " Help talk: "; echo $EditHT; //Help talk }       if($EditC!=''){ echo " Category: "; echo $EditC; //Category }       if($EditCT!=''){ echo " Category talk: "; echo $EditCT; //Category talk }       if($EditPortal!=''){ echo " Portal: "; echo $EditPortal; //Portal }       if($EditPortalT!=''){ echo " Portal talk: "; echo $EditPortalT; //Portal talk }       if($EditSchool!=''){ echo " School: "; echo $EditSchool; //School }       if($EditSchoolT!=''){ echo " School talk: "; echo $EditSchoolT; //School talk }       if($EditTopic!=''){ echo " Topic: "; echo $EditTopic; //Topic }       if($EditTopicT!=''){ echo " Topic talk: "; echo $EditTopicT; //Topic talk }     }   } } else { echo file_get_contents("display/form.txt"); } echo file_get_contents("display/end.txt"); ?> //