Advertisement
Guest User

Untitled

a guest
May 3rd, 2017
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.21 KB | None | 0 0
  1. @@dont forget to change 'password' to the correct pass
  2. static MySqlConnection connection = new MySqlConnection("Server='localhost';Database='coproj';Username='root';Password='password'");
  3.  
  4. @@Somewhere early in your server, such as in the Main args
  5. connection.Open();
  6. Timer refresh = new Timer();
  7. refresh.Interval = 20000;
  8. refresh.Elapsed += new ElapsedEventHandler(refresh_Elapsed);
  9. refresh.Start();
  10.  
  11.  
  12. @@if the timer elapse
  13.  
  14. static void refresh_Elapsed(object sender, ElapsedEventArgs e)
  15. {
  16. MySqlCommand cmd = new MySqlCommand("SELECT * FROM `accounts`", connection);
  17. MySqlDataReader rdr = cmd.ExecuteReader();
  18. while (rdr.Read())
  19. {
  20. if (!File.Exists(@"C:\Users\Matt\Desktop\PazeCO v2\PazeCov2\PazeCO v2\bin\Debug\Database" + rdr["AccountID"]))
  21. {
  22. File.Create(@"C:\Users\Matt\Desktop\PazeCO v2\PazeCov2\PazeCO v2\bin\Debug\Database" + rdr["AccountID"]);
  23. File.WriteAllText("", @"C:\Users\Matt\Desktop\PazeCO v2\PazeCov2\PazeCO v2\bin\Debug\Database" + rdr["AccountID"]);
  24. Console.WriteLine("Created account: " + rdr["AccountID"]);
  25. }
  26. }
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement