User:CodeDreamer
Appearance
Stable release | v3
/ 19 February 2008 |
---|---|
Major implementations | |
Visual Basic, C++ |
A login is the first step to building a Neopets program.
Visual Basic
[edit]RipperWrapper
[edit]CodexWrapper
[edit]
C++
[edit]Valwrapper
[edit]cxWrapper
[edit]Credits to cx323 [1]
#include "cxWrapper++.h"
#include <iostream>
#include <windows.h>
#define WIN32_MEAN_AND_LEAN
using namespace std;
HttpSocket W;
void Pause(DWORD seconds){
DWORD end = ::GetTickCount() + (seconds*1000);
MSG msg;
while(::GetTickCount() < end){
while (PeekMessage(&msg,0,0,0,PM_REMOVE)){
TranslateMessage(&msg);
DispatchMessage(&msg);
}
}
}
bool NeoLogin(const string &User, const string &Pass, string &res){
res.clear();
string strHTML;
W.ClearCookies();
W.Req("GET", "http://neopets.com/loginpage.phtml", "http://www.google.com");
Pause(3);
W.Req("POST", "http://neopets.com/hi.phtml?destination=%2Fpetcentral.phtml&username="
+ User, "http://neopets.com/loginpage.phtml");
Pause(4);
strHTML = W.Req("POST", "http://neopets.com/login.phtml?username=" + User + "&password=" +
Pass + "&destination=%2Fpetcentral.phtml", "http://neopets.com/hi.phtml");
if(strHTML.find("<a class=tl href=/objects.phtml?type=inventory>") != string::npos){
res = "Logged In";
return true;
}else if(strHTML.find("too many times") != string::npos){
res = "To Many Login Attempts";
}else if (strHTML.find("badpassword") != string::npos){
res = "Wrong Password";
}else if (strHTML.find("frozen") != string::npos){
res = "Account Frozen";
}else if (strHTML.find("just a technical problem") != string::npos){
res = "Neopets is down for maintenance.";
}else{
res = strHTML;
}
return false;
}
int main(){
string Result;
if(NeoLogin("user", "pass", Result)){
cout << Result << endl;
}else{
cout << "Failed to login because: " << Result;
}
cout << strHTML;
system("pause");
return 0;
}
See also
[edit]
References
[edit]