Show DevBest [C#] License System

Status
Not open for further replies.

Meap

Don't need glasses if you C#
Nov 7, 2010
1,045
296
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
 

Quackster

a devbest user says what
Aug 22, 2010
1,765
1,245
This is been released - no shit. Heaps of times, but eh nice anyway :)

Credits to Cobe? :p
 

Tr0ll.

Member
Nov 20, 2010
99
5
I don't respect people releasing my things else-where.

And people wonder why I don't release my work at all.

This is the old one, but still that is rude.
 

Meap

Don't need glasses if you C#
Nov 7, 2010
1,045
296
I found it on another forum and thought Id re-release it for the community
 

Meap

Don't need glasses if you C#
Nov 7, 2010
1,045
296
I aint changed a thing, that was the code I found
 

Heth0d

New Member
May 21, 2011
19
0
i'd agree i dont really think that this one is his neither that he coded
If he did then nice job mate.
 
Status
Not open for further replies.

Users who are viewing this thread

Top