You are on page 1of 1

var

htp: TIdHTTP;
url: string;
lst: Tstringlist;
jso: TJSONObject;
jsod: TJSONObject;
jsa: TJSONArray;
pan: string;
sts: integer;

begin
htp := TIdHTTP.Create(nil);
lst := TStringlist.Create;
lst.Add('username=' + Edit1.Text);
lst.Add('password=' + Edit2.Text);

url := 'http://nusaputra.somantri.id/ti17/rully/login.php';

try
url := htp.Post(url, lst) ;
finally
FreeandNil(htp);
lst.Free;
end;

begin
jso := TJSONObject.ParseJSONValue(url) as TJSONObject;
pan := jso.GetValue('message').Value;
sts := strToint(jso.GetValue('value').Value);

if sts = 1 then
begin
showmessage(pan);
Formenu.Show;
Formlogin.Hide;
end
else
showmessage(pan);
jso.Free;
end;

You might also like