Advertisement
PluzVS

LoginFunc.cs

Mar 19th, 2016
1,069
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.68 KB | None | 0 0
  1. // https://www.youtube.com/channel/UCQW99lqxlE--SKt6Ry2kqwQ //
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. using System.Text;
  6. using System.Threading.Tasks;
  7. using System.IO;
  8. using System.Net;
  9.  
  10. namespace LoginRequest
  11. {
  12.     class LoginFunc
  13.     {
  14.         public static bool Login(String Usuario, String Senha)
  15.         {
  16.             string data = null;
  17.             data = "auth_key=880ea6a14ea49e853634fbdc5015a024&referer=http%3A%2F%2Flocalhost%2F&ips_username="+ Usuario +"&ips_password=" + Senha + "&rememberMe=1";
  18.             try
  19.             {
  20.                 WebRequest request = WebRequest.Create("http://localhost/index.php?app=core&module=global&section=login&do=process");
  21.                 request.Method = WebRequestMethods.Http.Post;
  22.                 request.ContentType = "application/x-www-form-urlencoded";
  23.                 request.ContentLength = data.Length;
  24.                 StreamWriter rStream = new StreamWriter(request.GetRequestStream());
  25.                 rStream.Write(data);
  26.                 rStream.Flush();
  27.                 rStream.Close();
  28.                 WebResponse response = request.GetResponse();
  29.                 StreamReader resReader = new StreamReader(response.GetResponseStream());
  30.                 string str = resReader.ReadToEnd();
  31.                 if (str.Contains("Username or password incorrect."))
  32.                 {
  33.                     return false;
  34.                 }
  35.                 else
  36.                 {
  37.                     return true;
  38.                 }
  39.                 response.Close();
  40.             }
  41.             catch(Exception ex)
  42.             {
  43.                 return false;
  44.             }
  45.  
  46.  
  47.         }
  48.  
  49.  
  50.     }
  51. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement