SRL Archive - Help and Support

using post variable with scar


omgh4x0rz

2007-04-14 14:43:07

hey, I'm trying to figure out how to do an auth system using the PostHTTPPage. I'm not sure what I'm supposed to put for the client argument though. SRL stats uses SRLClient, but what is that actually…?

thanks

Markus

2007-04-16 14:06:35

You mean something like this?

function Auth(username, password : string) : boolean;
var httpc : integer;
s : string;
begin
httpc := InitializeHTTPClient(false, false);
AddPostVariable(httpc, 'username', username);
AddPostVariable(httpc, 'password', password);
s := PostHTTPPageEx(httpc, 'http://youre.url.here.com/some.page.php');
if (s = 'AUTH ACCEPTED')
then result := true else result := false;
FreeHTTPClient(httpc);
end;
First it inits a HTTP Client, then add the post vars to it, and finally post the page with the vars and verify the string it returns.

omgh4x0rz

2007-04-17 14:35:10

Yea, so this is what I was trying.

I'm pretty sure all the html and php code at test.php is working, because I made another page with a login form that will send a post variable, and that gets accepted. When scar sends it however, the page returns the message I have saying that the the authorization was not accepted. I don't really get what the initializing client part is for though, could that be what I'm doing wrong?

program InternetTest;
var
myclient:integer;
ret:string;

begin
myclient := InitializeHTTPClient( true, true );
ClearPostData(myclient);
AddPostVariable(myclient, 'auth', '666');
ret:=PostHTTPPageEx(myclient,'http://omgh4x0rz.freehostia.com/test.php');
writeln(ret);
FreeHTTPClient(myclient);
end.