Sanal güvenlik kodu yenileme örnek C#.net

E-Posta sanal güvenlik programı için 4 textbox , 5 label ve  2 butoton ekliyoruz…

adsiz7

[code language=”csharp”]
{
string[] eposta = { "abc@hotmail.com", "asi", "123" };
[/code]

3 Tane girilecek değr belirliyoruz…!

[code language=”csharp”]
string[] eposta1 = { "def@hotmail.com", "bucur", "456" };
string[] eposta2 = { "pc@hotmail.com", "ufak", "789" };

string[] harf ={ "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "r", "s", "t", "u","v", "y", "z" };
[/code]

harfleri bir değişkenine belirliyoruz…!

[code language=”csharp”]
string[] sayi = { "0", "1", "2", "3", "4", "5", "6", "7", "8", "9" };
[/code]

rakamları bir değişkene atıyoruz…!

[code language=”csharp”]
int a, b, c, d, g, f;
[/code]

değişkenlerimizi belirliyoruz…!

[code language=”VB.net”]
Random r = new Random();
[/code]

rasgele değişkenimizi belirledik

[code language=”csharp”]

{
InitializeComponent();
}

{
a = r.Next(0, sayi.Length);
[/code]

a değişkenine sıfıla sayi dizinin içinde ki sayılar arasında bi sayıyı rasgele seçmesini sağlayan bir kodtur…!

[code language=”csharp”]
b = r.Next(0, sayi.Length);
c = r.Next(0, sayi.Length);
d = r.Next(0, harf.Length);
[/code]

harf dizinin içinde girilen değerler arasında bi değeri rasgele seçmeye yarayan kodtur…!

[code language=”csharp”]
g = r.Next(0, harf.Length);
f = r.Next(0, harf.Length);
label4.Text = sayi[a] + " " + harf[d] + " " + sayi[b] + " " + harf[g] + " " + sayi[c] + " " + harf[f];
[/code]

Rasgele belirlenen değerleri labele yazdırma…!
butona bastığımızda belirleyen komutlar…!

[code language=”csharp”]
{
a = r.Next(0, sayi.Length);
b = r.Next(0, sayi.Length);
c = r.Next(0, sayi.Length);
d = r.Next(0, harf.Length);
g = r.Next(0, harf.Length);
f = r.Next(0, harf.Length);
label4.Text = sayi[a] + " " + harf[d] + " " + sayi[b] + " " + harf[g] + " " + sayi[c] + " " + harf[f];
}
[/code]
[code language=”csharp”]
{
label4.Text = label4.Text.Replace(" ", "");
[/code]

Boşlukları saymamasını sağlayan komuttur…!

[code language=”csharp”]
if (label4.Text == textBox4.Text && eposta[0] == textBox1.Text && eposta[1] == textBox2.Text && eposta[2] == textBox3.Text)
{
MessageBox.Show("Doğrulandı");
}
else if (label4.Text == textBox4.Text && eposta1[0] == textBox1.Text && eposta1[1] == textBox2.Text && eposta1[2] == textBox3.Text)
{
MessageBox.Show("Doğrulandı");
}
else if (label4.Text == textBox4.Text && eposta2[0] == textBox1.Text && eposta2[1] == textBox2.Text && eposta2[2] == textBox3.Text)
MessageBox.Show("Doğrulandı");
}
Else
{
MessageBox.Show("Yanlış Giriş");
}
}
}
}
[/code]

girilen değerler eğer dizinin içindeki kodlara uyumlu değilse uyarı mesajı versin…!

Yorumlar 2

Bir yanıt yazın

E-posta adresiniz yayınlanmayacak. Gerekli alanlar * ile işaretlenmişlerdir