Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // https://www.youtube.com/channel/UCQW99lqxlE--SKt6Ry2kqwQ //
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.IO;
- using System.Net;
- namespace LoginRequest
- {
- class LoginFunc
- {
- public static bool Login(String Usuario, String Senha)
- {
- string data = null;
- data = "auth_key=880ea6a14ea49e853634fbdc5015a024&referer=http%3A%2F%2Flocalhost%2F&ips_username="+ Usuario +"&ips_password=" + Senha + "&rememberMe=1";
- try
- {
- WebRequest request = WebRequest.Create("http://localhost/index.php?app=core&module=global§ion=login&do=process");
- request.Method = WebRequestMethods.Http.Post;
- request.ContentType = "application/x-www-form-urlencoded";
- request.ContentLength = data.Length;
- StreamWriter rStream = new StreamWriter(request.GetRequestStream());
- rStream.Write(data);
- rStream.Flush();
- rStream.Close();
- WebResponse response = request.GetResponse();
- StreamReader resReader = new StreamReader(response.GetResponseStream());
- string str = resReader.ReadToEnd();
- if (str.Contains("Username or password incorrect."))
- {
- return false;
- }
- else
- {
- return true;
- }
- response.Close();
- }
- catch(Exception ex)
- {
- return false;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement