示例#1
0
 private void simpleButton1_Click(object sender, EventArgs e)
 {
     try
     {
         string thisguid = HWDI.GetMachineGuid();
         server.Connect("localhost", 80);
         string loginusername = textEdit1.Text;
         string loginpassword = textEdit2.Text;
         if (client.DownloadString(URL + "api.php?type=login&username="******"&password="******"&hwid=" + thisguid).Contains("0x05"))
         {
             XtraMessageBox.Show("Successfully logged in.", "Success!");
             //Open form, or do whatever people do here.
         }
         else if (client.DownloadString(URL + "api.php?type=login&username="******"&password="******"&hwid=" + thisguid).Contains("0x01"))
         {
             XtraMessageBox.Show("HWID doesn't match.", "ERROR");
         }
         else if (client.DownloadString(URL + "api.php?type=login&username="******"&password="******"&hwid=" + thisguid).Contains("0x02"))
         {
             XtraMessageBox.Show("Please fill in all fields.", "ERROR");
         }
         else if (client.DownloadString(URL + "api.php?type=login&username="******"&password="******"&hwid=" + thisguid).Contains("0x03"))
         {
             XtraMessageBox.Show("Username or password are invalid.", "ERROR");
         }
         else if (client.DownloadString(URL + "api.php?type=login&username="******"&password="******"&hwid=" + thisguid).Contains("0x04"))
         {
             XtraMessageBox.Show("You are banned.", "ERROR");
         }
     }
     catch (WebSocketException)
     {
         XtraMessageBox.Show("Server is unavailable", "Server ERROR", MessageBoxButtons.YesNo, MessageBoxIcon.Error);
     }
 }
示例#2
0
 private void simpleButton2_Click(object sender, EventArgs e)
 {
     try
     {
         string thisguid = HWDI.GetMachineGuid();
         server.Connect("localhost", 80);
         string loginusername = textEdit1.Text;
         string loginpassword = textEdit2.Text;
         if (client.DownloadString("http://localhost/projects/tools/api.php?type=register&username="******"&password="******"&rpassword="******"&email=" + textEdit4.Text + "&hwid=" + thisguid).Contains("0x6"))
         {
             XtraMessageBox.Show("User is registered.", "SUCCESS");
             this.Close();
         }
         else if (client.DownloadString("http://localhost/projects/tools/api.php?type=register&username="******"&password="******"&rpassword="******"&email=" + textEdit4.Text + "&hwid=" + thisguid).Contains("0x1"))
         {
             XtraMessageBox.Show("Please fill in all fields.", "ERROR");
         }
         else if (client.DownloadString("http://localhost/projects/tools/api.php?type=register&username="******"&password="******"&rpassword="******"&email=" + textEdit4.Text + "&hwid=" + thisguid).Contains("0x2"))
         {
             XtraMessageBox.Show("Username is already in use.", "ERROR");
         }
         else if (client.DownloadString("http://localhost/projects/tools/api.php?type=register&username="******"&password="******"&rpassword="******"&email=" + textEdit4.Text + "&hwid=" + thisguid).Contains("0x3"))
         {
             XtraMessageBox.Show("Username must be alphanumberic and 4-15 characters in length.", "ERROR");
         }
         else if (client.DownloadString("http://localhost/projects/tools/api.php?type=register&username="******"&password="******"&rpassword="******"&email=" + textEdit4.Text + "&hwid=" + thisguid).Contains("0x4"))
         {
             XtraMessageBox.Show("Email is not a valid email address.", "ERROR");
         }
         else if (client.DownloadString("http://localhost/projects/tools/api.php?type=register&username="******"&password="******"&rpassword="******"&email=" + textEdit4.Text + "&hwid=" + thisguid).Contains("0x5"))
         {
             XtraMessageBox.Show("Passwords do not match.", "ERROR");
         }
     }
     catch (WebSocketException)
     {
         XtraMessageBox.Show("Server is unavailable", "Server ERROR", MessageBoxButtons.YesNo, MessageBoxIcon.Error);
     }
 }