Meap
Don't need glasses if you C#
PHP:
/// <summary>
/// Check's the user's License
/// </summary>
private static void LicenseCheck()
{
/*Notes*/
//Very insecure will be re-written.
//Possibly will go by Forum
//Forum test is commented out.
int pause = 1300;
string SQL = IO.workingDirectory + @"\config\mysql.ini";
dbKey = IO.readINI("license", "key", SQL);
keyName = IO.readINI("license", "name", SQL);
//forumUser = IO.readINI("forum", "name", SQL);
//forumPass = IO.readINI("forum", "pw", SQL);
Thread.Sleep(pause);
Out.WriteBlank();
Console.WriteLine("Would you like your license checked online or offline?");
string type = Console.ReadLine();
Out.WriteBlank();
if (type == "offline")
{
Console.WriteLine("Checking your license..");
Thread.Sleep(pause);
Out.WriteBlank();
string key = dbKey;
string name = keyName;
string asertisk = "-";
if (dbKey.Length == 19 && key.Contains(asertisk))
{
Console.WriteLine("License [***************] has been accepted");
Thread.Sleep(pause);
Out.WriteBlank();
if (keyName.Length > 7 && name.Contains(asertisk))
{
Console.WriteLine("Name [ " + keyName + " ] has been accepted");
Thread.Sleep(pause);
Out.WriteBlank();
Boot();
}
else
{
Console.WriteLine("Your name is invalid");
Shutdown(10);
}
}
else
{
Console.WriteLine("Your license is invalid");
Shutdown(10);
}
}
if (type == "online")
{
Console.WriteLine("Checking your license..");
Thread.Sleep(pause);
/*if (forumUser.Length == 0)
{
Console.WriteLine("Seems you didn't specify your MyForumt.com Username, would you like me to write one in for you?");
string choice = Console.ReadLine();
Out.WriteBlank();
if (choice == "yes")
{
Console.WriteLine("Ok, username?");
string name = Console.ReadLine();
IO.writeINI("forum", "name", name, SQL);
Console.WriteLine("Done, proceeding with the process!");
Out.WriteBlank();
}
if (choice == "no")
{
Shutdown(7);
}
}
if (forumUser.Length == 0)
{
Console.WriteLine("Seems you didn't specify your Dev-Studios.net Password, would you like me to write one in for you?");
string choice = Console.ReadLine();
Out.WriteBlank();
if (choice == "yes")
{
Console.WriteLine("Ok, password?");
string pw = Console.ReadLine();
//hotelName = IO.readINI("hotel", "hotelname", SQL);
IO.writeINI("forum", "pw", pw, SQL);
Console.WriteLine("Done, proceeding with the process!");
Out.WriteBlank();
}
if (choice == "no")
{
Shutdown(7);
}
Console.WriteLine("Checking your license now..");
Thread.Sleep(pause);
}*/
if (dbKey.Length < 19)
{
Console.WriteLine("Your license is invalid");
Shutdown(10);
}
else
{
string[] license = new string[6];
license[0] = new WebClient().DownloadString("http://YOURURL/LICENSEFILE");
license[1] = dbKey;
license[2] = keyName;
if (license[0].Contains(license[1] + ";" + license[2]))
{
Console.WriteLine("License Key : [ " + license[1] + " ] Accepted");
Boot();
}
else
{
Console.WriteLine("Your license is invalid, contact an administrator");
Shutdown(5);
}
}
}
}
-----------------------------------------New Shutdown!-----------------------------------------
/// <summary>
/// Rewritten by Cobe, basically the programmer chooses how many seconds the emulator will shutdown in.
/// </summary>
public static void Shutdown(int second)
{
Out.WriteBlank();
if(serverMonitor.IsAlive)
serverMonitor.Abort();
int time = second * 1000;
Out.WriteLine("Emulator shutting down in " + second + " seconds");
Thread.Sleep(time);
Console.Beep(1400,1000);
Environment.Exit(2);
}
--------------------------------Required Namespace---------------------------------------------
using System.Net;
--------------------------------Required Strings-----------------------------------------------
//Put these after "public static string dbPassword;"
public static string keyName;
public static string dbKey;
Note I did not release this
Credits to makarov