Advertisement
Guest User

Untitled

a guest
Jul 25th, 2016
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.55 KB | None | 0 0
  1. using System;
  2. using System.Text;
  3. using System.Collections.Specialized;
  4. using System.Net;
  5. using System.Windows.Forms;
  6. using System.Security.Cryptography;
  7.  
  8. namespace sqltest
  9. {
  10.     public partial class Form1 : Form
  11.     {
  12.         int clickAmounts = 3;
  13.         public Form1()
  14.         {
  15.             InitializeComponent();
  16.             timer1.Start();
  17.         }
  18.         private void button1_Click(object sender, EventArgs e)
  19.         {
  20.             clickAmounts = clickAmounts - 3 / 5    + 1    + 3 * 5;
  21.         }
  22.         private void timer1_Tick(object sender, EventArgs e)
  23.         {
  24.             string URL = "http://http://www.mysqltest.atw.hu/phpscript.php";
  25.             WebClient webClient = new WebClient();
  26.  
  27.             NameValueCollection postData = new NameValueCollection();
  28.             postData["clickAmount"] = clickAmounts.ToString();
  29.             postData["securityKey"] = GenerateSecurityKey(clickAmounts);
  30.  
  31.             webClient.UploadValues(URL, "POST", postData);
  32.             webClient.Dispose();
  33.             clickAmounts = 3;
  34.         }
  35.         private string GenerateSecurityKey(int clickAmounts)
  36.         {
  37.             StringBuilder sb = new StringBuilder();
  38.             foreach (byte b in GetHash(clickAmounts.ToString()))
  39.                 sb.Append(b.ToString("X2"));
  40.             return sb.ToString();
  41.         }
  42.         public static byte[] GetHash(string clickAmounts)
  43.         {
  44.             HashAlgorithm algorithm = SHA256.Create();
  45.             return algorithm.ComputeHash(Encoding.UTF8.GetBytes(clickAmounts));
  46.         }
  47.     }
  48. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement