Advertisement
Guest User

Untitled

a guest
Feb 18th, 2016
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.67 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Windows.Forms;
  9. using System.IO;
  10. using System.Net;
  11. using System.Diagnostics;
  12.  
  13. namespace Login
  14. {
  15. public partial class Form1 : Form
  16. {
  17. private TextBox txtPassword;
  18. private TextBox txtUsername;
  19. public string Username { get; set; }
  20.  
  21. public string Password { get; set; }
  22. public Form1(string user, string pass)
  23. {
  24. this.InitializeComponent();
  25. this.txtUsername.Text = user;
  26. this.txtPassword.Text = pass;
  27. }
  28. private void PlJcEasmpb(object sender, EventArgs e)
  29. {
  30. this.Username = this.txtUsername.Text;
  31. this.Password = this.txtPassword.Text;
  32. this.Close();
  33. }
  34. private void Form1_Load(object sender, EventArgs e)
  35. {
  36.  
  37. }
  38.  
  39. private void button1_Click(object sender, EventArgs e)
  40. {
  41.  
  42. StreamReader reader = new StreamReader(new WebClient().OpenRead("http://website.com/login.php?user=" + this.Username + "&pass=" + this.Password));
  43. string status = reader.ReadToEnd();
  44. if (status == "ok")
  45. {
  46. // đăng nhập thành công
  47. }
  48. else
  49. {
  50. // sai tài khoản hoặc mật khẩu
  51. }
  52. }
  53.  
  54. private void textBox2_TextChanged(object sender, EventArgs e)
  55. {
  56.  
  57. }
  58.  
  59. private void textBox1_TextChanged(object sender, EventArgs e)
  60. {
  61.  
  62. }
  63. }
  64. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement