Umarım birilerinin ihtiyacını karşılar. Sistem MySQL Remote bağlantısı ile çalışıyor. Gecikmeden başlayalım 
Form1 Public Class içerisinde yazılacak olan kodlar şunlar;
public MySqlCommand CommandDB;
public MySqlDataReader DataReaderDB;
public MySqlConnection ConnectDB = new MySqlConnection("Server=localhost;Database=licdb;Uid=root;Pwd='secretpass';SSLMode=none;AllowUserVariables=True;UseCompression=True");Daha sonra, bize lisans hash'i üretecek kodu yazalım, bunu da giriş seviyesi olarak MD5 ile tasarladım, bilginiz dahilinde değiştirebilirsiniz. public static string MD5Sifrele(string sifrelenecekMetin)
{
MD5CryptoServiceProvider md5 = new MD5CryptoServiceProvider();
byte[] dizi = Encoding.UTF8.GetBytes(sifrelenecekMetin);
dizi = md5.ComputeHash(dizi);
StringBuilder sb = new StringBuilder();
foreach (byte ba in dizi)
{
sb.Append(ba.ToString("x2").ToLower());
}
return sb.ToString();
}Akabinde, form load kodlarını yazalım onlar da şu şekilde ; try
{
ConnectDB.Open();
if (ConnectDB.State != ConnectionState.Closed)
{
//Eğer bağlantı sağlandıysa lisansı kontrol et
listBox1.Items.Add("DB Server Connect OK !");
string hostname = System.Environment.MachineName;
string username = System.Environment.UserName;
Thread.Sleep(3500);
string GetIPAddress()
{
String address = "";
WebRequest request = WebRequest.Create("http://checkip.dyndns.org/");
using (WebResponse response = request.GetResponse())
using (StreamReader stream = new StreamReader(response.GetResponseStream()))
{
address = stream.ReadToEnd();
}
int first = address.IndexOf("Address: ") + 9;
int last = address.LastIndexOf("</body>");
address = address.Substring(first, last - first);
return address;
}
string sifre = MD5Sifrele(username + hostname + GetIPAddress());
label2.Text = sifre;
listBox1.Items.Add("Checking License. Please Wait.");
listBox1.Items.Add("Your External IP Address : " + GetIPAddress());
CommandDB = new MySqlCommand();
CommandDB.Connection = ConnectDB;
CommandDB.CommandText = "SELECT * FROM licenses where externalip='" + GetIPAddress() + "' AND hostname='" + hostname + "' AND username='" + username + "' AND hashed='" + sifre + "'";
DataReaderDB = CommandDB.ExecuteReader();
if (DataReaderDB.Read())
{
listBox1.Items.Add("Your license valid. Hello "+ username + " !");
Thread.Sleep(3500);
//Yapılacak olan işlem komutunu buraya yazın
}
else
{
listBox1.Items.Add("Your license not valid !");
listBox1.ForeColor = Color.Red;
}
ConnectDB.Close();
}
else
{
listBox1.Items.Add("DB Server Connection FAİL!!");
MessageBox.Show("Internet bağlantınızı kontrol edin. Eğer Internet bağlantınız mevcut ise, programı aldığınız yere bu kodu gösterin : DB-012CON");
}
}
catch (Exception err)
{
listBox1.Items.Add("DB Server Connection FAİL!!");
label2.Text = "DB Connection FAİL !!";
label2.ForeColor = Color.Red;
}Veee unutmadan, Using kısmını da şu şekilde yapın ;using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; using MySql.Data; using MySql.Data.MySqlClient; using System.Threading; using System.Management; using System.Threading.Tasks; using Microsoft.Win32; using System.Net; using System.IO; using System.Security.Cryptography;Önemli not : MySQL eklentisini NuGET üzerinden kurun.
Ücret : Bir adet beğeni