Code (Text): <?php /** ****************** * Neopets Avatar * * Getter * ****************** * @author Archon * * @copyright 2009* ****************** */ set_time_limit(0); class httpwrapper { private $cookies; private $lastpage; private $html; private $headers; function __construct() { $this->useproxy = false; $this->cookies = array(); $this->lastpage = NULL; } public function getLastPage() { return $this->lastpage; } public function clearCookies() { $this->cookies = array(); } public function req($type, $url, $postdata = NULL, $referer = NULL, $follow_location = true, $return_headers = false) { if($referer == NULL) { if($this->lastpage != NULL) $r = "Referer: " . $this->lastpage . "\r\n"; } else $r = "Referer: $referer\r\n"; $url = str_replace("http://", "", $url); $host = $this->getHost($url); $path = $this->getPath($url); $agent = "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.8) Gecko/2009032609 Firefox/3.0.8"; $type = strtoupper($type); if(!in_array($type,array("GET","POST"))) $type="GET"; $f = fsockopen($host . ":80"); if($f) { $h = "$type $path HTTP/1.1\r\n"; $h .= "HOST: $host\r\n"; $h .= "User-Agent: $agent\r\n"; $h .= $this->cookieString(); $h .= $r; if($type == "POST") { $length = strlen($postdata); $h .= "Content-Type: application/x-www-form-urlencoded\r\n"; $h .= "Content-Length: $length\r\n"; } $h .= "Connection: close\r\n\r\n"; if($type == "POST") $h .= $postdata; fwrite($f,$h); while(!feof($f)) $data.=fgets($f,256); list($headers,$html) = explode("\r\n\r\n", $data, 2); //list($rand,$html) = explode("\r\n", $html, 2); $this->html = $html; $this->lastpage = "http://".$url; $this->process_headers($headers,$url,$follow_location,$return_headers); return ($return_headers) ? $this->headers : $this->html; } } private function getHost($url) { if(strpos($url,"/") === FALSE) return $url; else return $this->gsb("<".$url,"<","/"); } private function getPath($url) { if(strpos($url,"/") === FALSE) return "/"; else return "/".$this->gsb($url.">","/",">"); } private function process_headers($headers,$url,$follow,$return) { $this->headers = $headers; $lines = explode("\n", $headers); foreach($lines AS $line) { if(substr($line,0,10) == "Set-Cookie") { $cookie = $this->gsb($line, "Set-Cookie: ", ";"); list($key,$val) = explode("=", $cookie, 2); $this->cookies[$key] = $val; } else if(substr($line,0,8) == "Location" && $follow == true) { $location = $this->gsb($line.">>", "Location: ", ">>"); $this->req("GET", "http://".$this->getHost($url).$location, null, null, true, $return); } } } private function cookieString() { if(count($this->cookies) > 0) { $string = "Cookie:"; foreach($this->cookies AS $k=>$v) $string .= " $k=$v;"; return $string."\r\n"; } } private function gsb($search, $start, $end) { list($a,$b) = explode($start, $search, 2); list($a,$b) = explode($end, $b, 2); return $a; } } $form = <<<EOF <html> <h3>Neopets Avatar Getter</h3> <form method="POST"> Neopets Username: <input type="text" name="user" /><br /> Neopets Password: <input type="text" name="pass" /><br /><br /><br /> <h4>Avatars Needed</h4> <img src="http://images.neopets.com/neoboards/avatars/pooralbert.gif"> <input type="checkbox" name="mutant" /><br /><br /> <img src="http://images.neopets.com/neoboards/avatars/haiku.gif"> <input type="checkbox" name="rorru" /><br /><br /><br /> Refresh Time: <input type="text" name="min" size="2" /> - <input type="text" name="max" size="2" /><br /><br /> <input type="submit" name="Submit" /> </form> </html> EOF; if(!$_POST["user"] || !$_POST["pass"]) die($form); $user = $_POST['user']; $pass = $_POST['pass']; $w = new httpwrapper(); $html = $w->req("POST", "http://www.neopets.com/login.phtml", "username=$user&password=$pass&destination=%2Findex.phtml&x=".rand(0,100)."&y=".rand(0,30), "http://www.neopets.com/hi.phtml", false, true); if(strpos($html, "badpassword.phtml") !== FALSE) die("Bad Password!"); elseif(strpos($html, "failed_bday") !== FALSE) die("Birthday Needed!"); elseif(strpos($w->req("GET", "http://www.neopets.com/"), "Welcome, <a") === FALSE) die("Reason for error is unknown. You could possibly be frozen! ;-;"); $mutant = $_POST['mutant']; $rorru = $_POST['rorru']; $min = (int)$_POST["min"]; $max = (int)$_POST["max"]; if($mutant == "on") { $av = $w->req("GET", "http://www.neopets.com/neoboards/preferences.phtml"); if(strpos($av, "value='pooralbert'") !== FALSE) echo "You already have the Mutant Graveyard of Doom avatar!"; else { while(strpos($html, "http://images.neopets.com/neoboards/avatars/pooralbert.gif") === FALSE){ $html = $w->req("GET", "http://www.neopets.com/halloween/gamegraveyard.phtml"); sleep(rand($min, $max)); } echo "Mutant Graveyard of Doom avatar obtained!"; } } if($rorru == "on") { $av = $w->req("GET", "http://www.neopets.com/neoboards/preferences.phtml"); if(strpos($av, "value='haiku'") !== FALSE) echo "You already have the Rorru avatar!"; else { while(strpos($html, "http://images.neopets.com/neoboards/avatars/haiku.gif") === FALSE){ $html = $w->req("GET", "http://www.neopets.com/island/haiku/haiku.phtml"); sleep(rand($min, $max)); } echo "Rorru avatar obtained!"; } } ?> Made by me (Wrapper was Charlie's doing) This gets Haiku and the Mutant Graveyard of Doom Avatar! And with random wait time! Enjoy. If you know PHP you can edit the avatars and change it to which one you want to get. ;o Oh and I uploaded this because the programming section needs to be more active. ):
Re: Neopets Avatar Refresher The "Helpful Zafara" avatar (do a search on "Avatar" in the help section of Neo) also takes random refreshing, although not nearly as much as Mutant Graveyard of DOOM does. And ninopino1, if you want to on your own main or whatever, you can always just hold down F5 for a bit. Or, if you're on Firefox, download/enable ReloadEvery, use custom for 1 second, and just leave that running for a bit. (Refreshing a page exactly every 1 second would have a much higher freeze rate than random waiting times, but it's only for a few avatars...I've done that on several accounts and have yet to be frozen.) Then just check "Preferences" on the NeoBoards to see if/when you've gotten the avatars. And, of course, kudos to you, Archon. *thumbs up*