Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- DateTime d1;
- try
- {
- string sql = $"select subscribe from dle_users where email = '{textBoxUserEmail.Text}' and password = '{sspass}' ";
- MySqlCommand command = new MySqlCommand(sql, conn);
- string date = command.ExecuteScalar().ToString();
- var client = new TcpClient("time.nist.gov", 13);
- using (var streamReader = new StreamReader(client.GetStream()))
- {
- var response = streamReader.ReadToEnd();
- var utcDateTimeString = response.Substring(7, 17);
- d1 = DateTime.ParseExact(utcDateTimeString, "yy-MM-dd HH:mm:ss", CultureInfo.InvariantCulture, DateTimeStyles.AssumeUniversal);
- }
- DateTime d2 = Convert.ToDateTime(date);
- TimeSpan time = d2 - d1;
- int days = time.Days;
- if (days > 0)
- {
- passlIsPass = true;
- if (conn != null && conn.State != ConnectionState.Closed)
- conn.Close();
- }
- if (days < 0)
- {
- DialogResult result = MessageBox.Show("Продлите подписку !", "Внимание", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- }
- }
- catch (Exception ex)
- {
- passlIsPass = false;
- DialogResult result = MessageBox.Show("Логин или пароль введен неверно", "Внимание", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- }
Add Comment
Please, Sign In to add comment