function vBulletinTest(PServer, PPort, AuthUsername, AuthPassword, URL, User, Pass: string; Time: Integer; var _Exit: Boolean):
Boolean;
var
Post: TStringList;
Sock: TIdHTTP;
SSL: TIdSSLIOHandlerSocketOpenSSL;
RES, S, Find, securitytoken, Find2: string;
begin
Result := False;
Post := TStringList.Create;
Sock := TIdHTTP.Create(nil);
SSL := TIdSSLIOHandlerSocketOpenSSL.Create(nil);
try
Sock.IOHandler:= SSL;
Sock.HandleRedirects := True;
Sock.Request.UserAgent := 'Mozilla/5.0 (Windows NT 6.2; rv:27.0) Gecko/20100101 Firefox/27.0';
Sock.ConnectTimeout := Time * 1000;
Sock.ReadTimeout := Time * 1000;
if (PServer <> '') and (PPort <> '') then
begin
Sock.ProxyParams.ProxyServer := PServer;
Sock.ProxyParams.ProxyPort := StrToInt(PPort);
end;
if (AuthUsername <> '') and (AuthPassword <> '') then
begin
Sock.Request.BasicAuthentication := True;
Sock.Request.Username := AuthUsername;
Sock.Request.Password := AuthPassword;
end;
try
RES := Sock.Get(URL);
except
end;
Find := '"s" value="';
Find2 := '"securitytoken" value="';
if Pos(FIND, RES) <> 0 then
begin
S := Copy(RES, Pos(FIND, RES) + 11 , 32);
securitytoken := Copy(RES, Pos(Find2, RES) + 23 , Pos('" />', RES));
end;
Post.Add('s=' + S);
Post.Add('securitytoken=guest');
//Post.Add('securitytoken=' + securitytoken);
//Post.Add('logintype=cplogin');
Post.Add('do=login');
Post.Add('vb_login_md5password='+ MD5Crypt(Pass));
Post.Add('vb_login_md5password_utf=' + MD5Crypt(Pass));
Post.Add('vb_login_username=' + User);
Post.Add('vb_login_password=' + Pass);
try
RES := Sock.Post(URL, Post);
except
on E: Exception do
begin
_Exit := True;
end;
end;
if Pos('function exec_refresh', RES) > 0 then
Result := True;
finally
Post.Free;
Sock.Free;
SSL.Free;
end;
end;