Code:
print 'Username: ';
$username = <STDIN>; chop $username;
if ((length($username) < 3) || (length($username) > 20)) {
print 'ERROR: Invalid username'; exit; }
print 'Password: ';
$password = <STDIN>; chop $password;
if (length($username) < 5) {
print 'ERROR: Invalid password'; exit; }
Request('GET', 'neopets.com/index.phtml', '', 'http://neopets.com/');
$res = Request('POST', 'neopets.com/hi.phtml', "destination=%2Fpetcentral.phtml&username=$username", 'http://neopets.com/index.phtml');
if ($res =~ 'Sorry, we did not find an account with that username.') {
print 'ERROR: Invalid username'; exit; }
$res = Request('POST', 'neopets.com/login.phtml', "username=$username&password=$password&destination=%2Fpetcentral.$phtml", 'http://neopets.com/hi.phtml');
if ($res =~ "Welcome, <a class=tl href=/randomfriend.phtml") {
print 'Login was successful';
} elsif ($res =~ 'Sorry, you have tried too many times to guess this password') {
print 'ERROR: Too many invalid login attempts'; exit;
} elsif ($res =~ 'This account has been <span style="color:#FF0000;font-weight:bold;">FROZEN</span>') {
print "ERROR: Account $username has been frozen"; exit;
} elsif ($res =~ 'That <font color="#FF0000"><strong>username/password</strong></font> combination is invalid.') {
print 'ERROR: Account password is invalid'; exit; }
else { print 'ERROR: Login was unsuccessful'; exit; }