Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @@dont forget to change 'password' to the correct pass
- static MySqlConnection connection = new MySqlConnection("Server='localhost';Database='coproj';Username='root';Password='password'");
- @@Somewhere early in your server, such as in the Main args
- connection.Open();
- Timer refresh = new Timer();
- refresh.Interval = 20000;
- refresh.Elapsed += new ElapsedEventHandler(refresh_Elapsed);
- refresh.Start();
- @@if the timer elapse
- static void refresh_Elapsed(object sender, ElapsedEventArgs e)
- {
- MySqlCommand cmd = new MySqlCommand("SELECT * FROM `accounts`", connection);
- MySqlDataReader rdr = cmd.ExecuteReader();
- while (rdr.Read())
- {
- if (!File.Exists(@"C:\Users\Matt\Desktop\PazeCO v2\PazeCov2\PazeCO v2\bin\Debug\Database" + rdr["AccountID"]))
- {
- File.Create(@"C:\Users\Matt\Desktop\PazeCO v2\PazeCov2\PazeCO v2\bin\Debug\Database" + rdr["AccountID"]);
- File.WriteAllText("", @"C:\Users\Matt\Desktop\PazeCO v2\PazeCov2\PazeCO v2\bin\Debug\Database" + rdr["AccountID"]);
- Console.WriteLine("Created account: " + rdr["AccountID"]);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement