Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

[Delphi] auto login and get site

Posted on 2011-02-19
3
1,586 Views
Last Modified: 2012-05-11
Hi i have problem with login into one site with send post. I downloaded Fiddler and i have all post/gets. My code:
Input := TStringStream.Create('');
  Input2 := TStringStream.Create('');
  Output := TStringStream.Create('');
  Output2 := TStringStream.Create('');
  http.Request.UserAgent := 'User-Agent: Opera/9.80 (Windows NT 5.1; U; pl) Presto/2.2.15 Version/10.10';
  http.Request.ContentType := 'application/x-www-form-urlencoded';
  http.Port := 80;
  http.Host := '212.72.179.30';
  Input.WriteString('user=nick&password=pw&clear=true');
  Input2.WriteString('user=nick&password=passwordHASH');
  http.Connect;
  http.Post('http://www.plemiona.pl/index.php?action=login&server_list=1&show_server_selection=1?', Input, Output);
  http.Post('http://www.plemiona.pl/index.php?action=login&server_pl51?', Input2, Output2);

  Memo1.Text := Output.DataString;
  Memo2.Text := Output2.DataString;
  http.Get('http://pl51.plemiona.pl/login.php?sid=34677eb40219&secret=0&mobile_no_force=0',output);
  http.Get('http://pl51.plemiona.pl/cookie.php?url=game.php%3Fscreen%3Doverview%26intro&',output2);
  Memo3.Text := Output.DataString;
  Memo4.Text := Output2.DataString;
  http.Get('http://pl51.plemiona.pl/game.php?screen=overview&intro',output);
  Memo5.Text := Output.DataString;
  http.Disconnect;

Open in new window


I get error when i try to Get first site: "EIDHTTPProtocolException with message 'HTTP/1.1 302 Found'"
I think this is problem with permission with it:
 http.Get('http://pl51.plemiona.pl/login.php?sid=34677eb40219&secret=0&mobile_no_force=0',output);        "sid=34677eb40219" i dont know where i can get it firefox sending it automatically. I dont know session. Could someone help me?
0
Comment
Question by:l3m0n
  • 2
3 Comments
 
LVL 26

Expert Comment

by:EddieShipman
ID: 34935320
Make sure you have  the  HandleRedirects property set to true because it may be redirecting you and
the idHTTP is not following.
0
 

Author Comment

by:l3m0n
ID: 34936678
i changed HandleRedirects to true and now i dont get error. But first get returns "session is wrong". Where can i find session? i cant find in cookie using this: "javascript:alert(document.cookie)"
0
 
LVL 26

Accepted Solution

by:
EddieShipman earned 500 total points
ID: 34937278
php does not save the session in a cookie.

You aren't providing enough info to continue.
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Foreword In the years since this article was written, numerous hacking attacks have targeted password-protected web sites.  The storage of client passwords has become a subject of much discussion, some of it useful and some of it misguided.  Of cou…
Foreword This article was written many years ago, in the days when PHP supported the MySQL extension (http://php.net/manual/en/function.mysql-connect.php).  Today (http://php.net/manual/en/migration70.removed-exts-sapis.php) you would not use MySQL…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

808 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question