71 lines
2.2 KiB
C#
71 lines
2.2 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel;
|
|
using System.Data;
|
|
using System.Drawing;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Windows.Forms;
|
|
using System.Net;
|
|
using System.IO;
|
|
|
|
namespace _3auth_test
|
|
{
|
|
static class Program
|
|
{
|
|
/// <summary>
|
|
/// The main entry point for the application.
|
|
/// </summary>
|
|
[STAThread]
|
|
static void Main()
|
|
{
|
|
Application.EnableVisualStyles();
|
|
Application.SetCompatibleTextRenderingDefault(false);
|
|
Application.Run(new MainInterface(true));
|
|
}
|
|
|
|
public static bool CheckLogin()
|
|
{
|
|
// Create web request and split the response
|
|
string response = Program.sendPostRequest("http://abyss.flash.moe/fii/3auth.php", "m=login&u=" + Program.flashii_id + "&s=" + Program.flashii_session);
|
|
|
|
// Change status to server response
|
|
if (response == "203")
|
|
return true;
|
|
else
|
|
return false;
|
|
}
|
|
|
|
public static string sendPostRequest(string URI, string postData)
|
|
{
|
|
// Create web request
|
|
WebRequest request = WebRequest.Create("http://abyss.flash.moe/fii/3auth.php");
|
|
|
|
// Set Useragent for identification
|
|
((HttpWebRequest)request).UserAgent = "Flashii Desktop";
|
|
|
|
// Set data
|
|
byte[] data = Encoding.UTF8.GetBytes(postData);
|
|
|
|
// Set Request and Content types and length
|
|
request.Method = "POST";
|
|
request.ContentType = "application/x-www-form-urlencoded";
|
|
request.ContentLength = data.Length;
|
|
|
|
// Get the reuqested stream
|
|
Stream dataStream = request.GetRequestStream();
|
|
|
|
// Write the data to the request stream
|
|
dataStream.Write(data, 0, data.Length);
|
|
|
|
// Get the response
|
|
string response = new StreamReader(((HttpWebResponse)request.GetResponse()).GetResponseStream()).ReadToEnd();
|
|
|
|
// Return response
|
|
return response;
|
|
}
|
|
|
|
public static string flashii_session = "";
|
|
public static string flashii_id = "0";
|
|
}
|
|
}
|