Sunucumda birden fazla hesap oluşturmaya çalıştığımda bu uyarıyı alıyorum. Bu projede, hostingimin veritabanında yeni bir kullanıcı oluşturmaya çalışıyorum ancak birden fazla hesap oluşturma iznim olmadığı için bu kodu kaldırmam gerekiyor. Neyi düzelteceğimi bilemediğim için yardımınızı istiyorum. Yardım edebilir misin?
C#:
public string identifier(string wmiClass, string wmiProperty)
{
string text = "";
foreach (ManagementBaseObject managementBaseObject in new ManagementClass(wmiClass).GetInstances())
{
ManagementObject managementObject = (ManagementObject)managementBaseObject;
if (text == "")
{
try
{
text = managementObject[wmiProperty].ToString();
break;
}
catch
{
}
}
}
return text;
}
private string request(NameValueCollection nvc, string action)
{
string @string;
using (WebClient webClient = new WebClient())
{
string str = "blabla.bla";
//MessageBox.Show(str + "/" + action + ".php");
byte[] bytes = webClient.UploadValues(str + "/" + action + ".php", nvc);
@string = Encoding.Default.GetString(bytes);
}
return @string;
}
private string genhash(string input)
{
byte[] array = new SHA1Managed().ComputeHash(Encoding.UTF8.GetBytes(input));
StringBuilder stringBuilder = new StringBuilder(array.Length * 2);
foreach (byte b in array)
{
stringBuilder.Append(b.ToString("X2"));
}
return stringBuilder.ToString();
}
public string hardwareid()
{
string str = this.identifier("Win32_DiskDrive", "Model");
string str2 = this.identifier("Win32_DiskDrive", "Manufacturer");
string str4 = this.identifier("Win32_DiskDrive", "TotalHeads");
string s = str + str2 + str4;
string result;
using (SHA1Managed sha1Managed = new SHA1Managed())
{
byte[] array = sha1Managed.ComputeHash(Encoding.UTF8.GetBytes(s));
StringBuilder stringBuilder = new StringBuilder(array.Length * 2);
foreach (byte b in array)
{
stringBuilder.Append(b.ToString("X2"));
}
result = stringBuilder.ToString();
}
return result;
}
private void button1_Click(object sender, EventArgs e)
{
try
{
Regex regex = new Regex("^[a-zA-Z0-9]*$");
if (!(this.textBox1.Text == string.Empty))
{
if (!(this.textBox2.Text == string.Empty))
{
if (regex.IsMatch(this.textBox1.Text))
{
if (regex.IsMatch(this.textBox2.Text))
{
NameValueCollection nameValueCollection = new NameValueCollection();
string text = this.textBox1.Text;
string value = this.genhash(this.textBox2.Text);
string value2 = this.hardwareid();
nameValueCollection["login"] = text.ToLower();
nameValueCollection["password"] = value;
nameValueCollection["identifier"] = value2;
string text2 = this.request(nameValueCollection, "register");
if (text2.Contains("success"))
{
MessageBox.Show("New account has been registered successfully. You can login now using your username/password!", "Registration successful!", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
}
else if (text2.Contains("overuse"))
{
MessageBox.Show("You can't register more than one account at one time!", "Failed", MessageBoxButtons.OK, MessageBoxIcon.Hand);
}
else if (text2.Contains("vpn"))
{
MessageBox.Show("Turn off your fucking vpn before attempting to register", "Failed", MessageBoxButtons.OK, MessageBoxIcon.Hand);
}
else if (text2.Contains("fail"))
{
MessageBox.Show("Unknown error occured. Try again", "login page", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
}
}
else
{
MessageBox.Show("Password must consist only of alphanumeric characters!", "login page", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
}
}
else
{
MessageBox.Show("Username must consist only of alphanumeric characters!", "login page", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
}
}
else
{
MessageBox.Show("maybe you should put your password?", "login page", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
}
}
else
{
MessageBox.Show("maybe you should put your username?", "login page", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
}
}
catch (Exception)
{
MessageBox.Show("Server is dead or your internet is not working. Try again later", "login page", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
}
}
}

