Advertisement
Guest User

Untitled

a guest
Feb 13th, 2016
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.69 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using System.Net;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9. using System.IO;
  10.  
  11. namespace LauncherZold
  12. {
  13. class SendToServer
  14. {
  15.  
  16. private bool proxy_setting = false;//not connected with proxy server
  17.  
  18. ////this is your proxy username,password,ip
  19. //private string proxy_ip = "http://192.168.1.1";//your proxy server
  20. //private string port = "80"; //proxy password
  21. //private string username = "username"; //proxy username
  22. //private string password = "password"; //proxy password
  23.  
  24. private string post_url_info = "http://localhost/dayz/engine.php";
  25. private string post_url_ban = "http://localhost/dayz/ban.php";
  26. private string post_url_ver = "http://localhost/dayz/ver.php";
  27. private string hash = "salt";
  28. public string sendTo(string nick,string hwid, string guid)
  29. {
  30. string _nick = nick;
  31. string _hwid = hwid;
  32. string _guid = guid;
  33. string result = "";
  34. string POST_DATA = "salt=" + hash + "&nick=" + _nick + "&hwid=" + _hwid + "&guid=" + _guid;
  35. string responseString = DataRequestToServer(POST_DATA, post_url_info);
  36. result = responseString;
  37. return result;
  38. }
  39. public string BanMe(string hwid, string nick, string guid)
  40. {
  41. string _nick = nick;
  42. string _hwid = hwid;
  43. string _guid = guid;
  44. string result = "";
  45. string POST_DATA = "salt=" + hash + "&nick=" + _nick + "&hwid=" + _hwid + "&guid=" + _guid;
  46. string responseString = DataRequestToServer(POST_DATA, post_url_ban);
  47. result = responseString;
  48. return result;
  49. }
  50.  
  51. public string getVer()
  52. {
  53. string result = "";
  54. string POST_DATA = "salt=" + hash;
  55. string responseString = DataRequestToServer(POST_DATA, post_url_ver);
  56. result = responseString;
  57. return result;
  58. }
  59.  
  60. public string sendCheats(string hwid, string req)
  61. {
  62. string _hwid = hwid;
  63. string _req = req;
  64. string result = "";
  65. string POST_DATA = "salt=" + hash + "&hwid=" + _hwid + "&req=" + _req;
  66. string responseString = DataRequestToServer(POST_DATA, post_url_ver);
  67. result = responseString;
  68. return result;
  69. }
  70.  
  71. public string DataRequestToServer(string postData, string url)
  72. {
  73. try
  74. {
  75. HttpWebRequest httpWReq = (HttpWebRequest)WebRequest.Create(url);
  76. //if (proxy_setting == true)
  77. //{
  78. // connectProxy(httpWReq);
  79. //}
  80. ASCIIEncoding encoding = new ASCIIEncoding();
  81. byte[] data = encoding.GetBytes(postData);
  82. httpWReq.Method = "POST";
  83. httpWReq.ContentType = "application/x-www-form-urlencoded";
  84. httpWReq.ContentLength = data.Length;
  85. using (Stream stream = httpWReq.GetRequestStream())
  86. {
  87. stream.Write(data, 0, data.Length);
  88. }
  89. HttpWebResponse response = (HttpWebResponse)httpWReq.GetResponse();
  90. string responseString = new StreamReader(response.GetResponseStream()).ReadToEnd();
  91. return responseString;
  92.  
  93. }
  94. catch (Exception e)
  95. {
  96. return e.Message;
  97. }
  98. }
  99.  
  100.  
  101.  
  102.  
  103. }
  104. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement