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 { public partial class LoginForm : Form { public LoginForm() { InitializeComponent(); } private void registerBtn_Click(object sender, EventArgs e) { if(MessageBox.Show("Do you want to open the registration page in your default browser?", "Registration", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) System.Diagnostics.Process.Start("http://flashii.net/register"); } private void loginBtn_Click(object sender, EventArgs e) { // Change status label statusLabel.Text = "Attempting to log in..."; usernameBox.Enabled = false; passwordBox.Enabled = false; loginBtn.Enabled = false; registerBtn.Enabled = false; // Check if username is set if (usernameBox.Text.Length < 1) { statusLabel.Text = "Username not entered."; usernameBox.Enabled = true; passwordBox.Enabled = true; loginBtn.Enabled = true; registerBtn.Enabled = true; return; } // Check if username is set if (passwordBox.Text.Length < 1) { statusLabel.Text = "Password not entered."; usernameBox.Enabled = true; passwordBox.Enabled = true; loginBtn.Enabled = true; registerBtn.Enabled = true; return; } // Create web request and split the response string[] response = Program.sendPostRequest("http://abyss.flash.moe/fii/3auth.php", "m=login&u=" + usernameBox.Text + "&p=" + passwordBox.Text).Split('|'); // Change status to server response if (response[0] == "104") { statusLabel.Text = "Login Success!"; Program.flashii_session = response[1]; Program.flashii_id = response[2]; MainInterface mainForm = new MainInterface(false); mainForm.Show(); LoginForm loginForm = new LoginForm(); loginForm.Hide(); } else { statusLabel.Text = "Login Failed."; switch (response[0]) { case "000": statusLabel.Text = "API unavailable"; break; case "101": statusLabel.Text += " Username or Password not set."; break; case "102": statusLabel.Text += " User does not exist or is not activated."; break; case "103": statusLabel.Text += " Username or Password is wrong"; break; case "104": statusLabel.Text += " Login successful but not?"; break; default: statusLabel.Text = "WHAT THE FUCK ARE YOU DOING?!?"; break; } usernameBox.Enabled = true; passwordBox.Enabled = true; loginBtn.Enabled = true; registerBtn.Enabled = true; return; } } private void LoginForm_Load(object sender, EventArgs e) { } } }