private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e) { //http://www.url.com/member.php?action=login if...

  1. private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e) {
  2. //http://www.url.com/member.php?action=login
  3. if ((textBox1->Text->IsNullOrWhiteSpace(textBox1->Text)) && (textBox1->Text->IsNullOrWhiteSpace(textBox2->Text)))
  4. {
  5. MessageBox::Show("Please fill in your credentials!", "url - Loader", MessageBoxButtons::OK,
  6. MessageBoxIcon::Error);
  7. }
  8. else
  9. {
  10. HttpWebRequest^ httpWebRequest = nullptr;
  11. HttpWebResponse^ httpWebResponse = nullptr;
  12. Stream^ stream = nullptr;
  13. StreamReader^ streamReader = nullptr;
  14. array<Byte>^ postBytes = nullptr;

  15. CookieContainer^ cookieContainer = gcnew CookieContainer();
  16. String^ sPostData = "username=" + textBox1->Text + "&password=" + textBox2->Text + "&remember=yes&submit=Login&action=do_login&url=http://url.com/member.php?action=login";
  17. String^ sFinalData = nullptr;

  18. try
  19. {
  20. httpWebRequest = (HttpWebRequest^)WebRequest::Create("http://www.url.com/");
  21. httpWebRequest->Method = "POST";
  22. httpWebRequest->ContentType = "application/x-www-form-urlencoded";
  23. postBytes = Encoding::UTF8->GetBytes(sPostData);
  24. httpWebRequest->ContentLength = postBytes->Length;
  25. httpWebRequest->CookieContainer = cookieContainer;

  26. stream = httpWebRequest->GetRequestStream();
  27. stream->Write(postBytes, 0, postBytes->Length);
  28. stream->Close();
  29. stream = nullptr;

  30. httpWebResponse = (HttpWebResponse^)httpWebRequest->GetResponse();
  31. streamReader = gcnew StreamReader(httpWebResponse->GetResponseStream(), Encoding::ASCII);

  32. sFinalData = streamReader->ReadToEnd();

  33. if (sFinalData->Contains("member.php?action=logout"))
  34. {
  35. MessageBox::Show("Login successful!", "", MessageBoxButtons::OK,
  36. MessageBoxIcon::Information);
  37. }
  38. else
  39. {
  40. MessageBox::Show("Login unsuccessful! Please check your credentials!", "", MessageBoxButtons::OK,
  41. MessageBoxIcon::Error);
  42. }
  43. }
  44. catch (Exception^ exception)
  45. {

  46. }
  47. }
 
💬 SpyHackerz Telegram — Anlık tartışmalar ve duyurular için katıl
132,010Konular
3,273,985Mesajlar
316,754Kullanıcılar
mahoo12Son Üye
Üst Alt