Advertisement
Guest User

ssad

a guest
Jan 9th, 2016
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.90 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.Threading.Tasks;
  9. using System.Windows.Forms;
  10. using System.Net;
  11. using System.Net.Sockets;
  12. using System.IO;
  13. using System.Collections.Specialized;
  14. using System.Threading;
  15.  
  16. namespace WindowsFormsApplication6
  17. {
  18. public partial class Form1 : Form
  19. {
  20. public Form1()
  21. {
  22. InitializeComponent();
  23. }
  24.  
  25.  
  26. private void sendbutton_Click(object sender, EventArgs e)
  27. {
  28.  
  29. }
  30.  
  31. private void Login_Click(object sender, EventArgs e)
  32. {
  33. if (Username.Text == "")
  34. {
  35. MessageBox.Show("Please enter your Username");
  36. }
  37. else
  38. {
  39. if (Password.Text == "")
  40. {
  41. MessageBox.Show("Please enter your Password");
  42. }
  43. else
  44. {
  45. if (email.Text == "")
  46. {
  47. MessageBox.Show("Please enter your Email");
  48. }
  49. else
  50. {
  51. string uriString = ("http://thedevspot.xyz:90/user/insert");
  52. WebClient myWebClient = new WebClient();
  53. NameValueCollection myNameValueCollection = new NameValueCollection();
  54.  
  55. string user = Username.Text;
  56. string pass = Password.Text;
  57. string mail = email.Text;
  58. string avatar = null;
  59. myNameValueCollection.Add("username", user);
  60. myNameValueCollection.Add("password", pass);
  61. myNameValueCollection.Add("email", mail);
  62. myNameValueCollection.Add("avatar", avatar);
  63. try
  64. {
  65. Console.WriteLine("\nUploading to {0} ...", uriString);
  66. byte[] responseArray = myWebClient.UploadValues(uriString, myNameValueCollection);
  67. Console.WriteLine("\nResponse received was :{0}", Encoding.ASCII.GetString(responseArray));
  68. MessageBox.Show("You successfully logged in!");
  69. wlcm.Text = ("Wellcome " + user + "!");
  70. }
  71. catch {
  72. Console.WriteLine("{0} exceptipm caught", e);
  73. MessageBox.Show("Error, try again");
  74. }
  75.  
  76. }
  77. }
  78. }
  79. }
  80.  
  81. private void Form1_Load(object sender, EventArgs e)
  82. {
  83.  
  84. }
  85. }
  86. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement