handle1 = InternetOpen(agent, 0, NULL, NULL, 0);
handle2 = InternetConnect(handle1, "secure.tibia.com", INTERNET_DEFAULT_HTTPS_PORT, NULL, NULL, INTERNET_SERVICE_HTTP, 0, 0);
handle3 = HttpOpenRequest(handle2, "POST", "/account/?subtopic=accountmanagement", NULL, NULL, 0, INTERNET_FLAG_SECURE,0);
if(HttpSendRequest(handle3,
"Content-Type: application/x-www-form-urlencoded\r\n",
-1,
(LPVOID)log,
strlen(log) + 1) == TRUE)
{ //
char buff[2000];
DWORD cblen = 2000;
if(HttpQueryInfo(handle3,HTTP_QUERY_STATUS_CODE,buff,&cblen,NULL) == TRUE && buff[0] == '2')
{
DWORD cont_len = -1;
cblen = 2000;
if(HttpQueryInfo(handle3,HTTP_QUERY_CONTENT_LENGTH,buff,&cblen,NULL) == TRUE)
{
sscanf(buff,"%u",&cont_len);
}
while(InternetReadFile(handle3,buff,min<DWORD>(2000,cont_len),&cblen) == TRUE && cblen > 0)
{ //
cont_len -= cblen;
} //
Form1->Memo1->Text=buff;
int k=GetLastError();
if(k == 0)
{
handle4 = HttpOpenRequest(handle2, "POST","/account/?subtopic=accountmanagement", NULL, NULL, 0, INTERNET_FLAG_SECURE,0);
if(HttpSendRequest(handle4,
"Content-Type: application/x-www-form-urlencoded\r\n",
-1,
(LPVOID)zm_hasla,
strlen(zm_hasla) + 1) == TRUE)
{//
char buff[2000];
DWORD cblen = 2000;
if(HttpQueryInfo(handle3,HTTP_QUERY_STATUS_CODE,buff,&cblen,NULL) == TRUE && buff[0] == '2')
{
DWORD cont_len = -1;
cblen = 2000;
if(HttpQueryInfo(handle3,HTTP_QUERY_CONTENT_LENGTH,buff,&cblen,NULL) == TRUE)
{
sscanf(buff,"%u",&cont_len);
}
while(InternetReadFile(handle3,buff,min<DWORD>(2000,cont_len),&cblen) == TRUE && cblen > 0)
{
cont_len -= cblen;
}
Form1->Memo1->Text=buff;
int pi=GetLastError();
if(pi == 0)
{
handle5 = HttpOpenRequest(handle2, "POST", "/account/?subtopic=accountmanagement&page=changepassword", NULL, NULL, 0, INTERNET_FLAG_SECURE,0);
if( (HttpSendRequest(handle5,
"Content-Type: application/x-www-form-urlencoded\r\n",
-1,
(LPVOID)zat_zmiane,
strlen(zat_zmiane) + 1))==TRUE){
int pi2=GetLastError();//pi2=2 czyli tak jakbym podawal zly dodatkowy header!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
char buff[2000];
DWORD cblen = 2000;
if(HttpQueryInfo(handle5,HTTP_QUERY_STATUS_CODE,buff,&cblen,NULL) == TRUE && buff[0] == '2')
{
DWORD cont_len = -1;
cblen = 2000;
if(HttpQueryInfo(handle5,HTTP_QUERY_CONTENT_LENGTH,buff,&cblen,NULL) == TRUE)
{
sscanf(buff,"%u",&cont_len);
}
while(InternetReadFile(handle5,buff,min<DWORD>(2000,cont_len),&cblen) == TRUE && cblen > 0)
{
cont_len -= cblen;
}
Form1->Memo1->Text=buff;
}
}
}
}
}
}
}
}
InternetCloseHandle(handle1);
InternetCloseHandle(handle2);
InternetCloseHandle(handle3);
InternetCloseHandle(handle4);
InternetCloseHandle(handle5);