Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Text;
- using System.Collections.Specialized;
- using System.Net;
- using System.Windows.Forms;
- using System.Security.Cryptography;
- namespace sqltest
- {
- public partial class Form1 : Form
- {
- int clickAmounts = 3;
- public Form1()
- {
- InitializeComponent();
- timer1.Start();
- }
- private void button1_Click(object sender, EventArgs e)
- {
- clickAmounts = clickAmounts - 3 / 5 + 1 + 3 * 5;
- }
- private void timer1_Tick(object sender, EventArgs e)
- {
- string URL = "http://http://www.mysqltest.atw.hu/phpscript.php";
- WebClient webClient = new WebClient();
- NameValueCollection postData = new NameValueCollection();
- postData["clickAmount"] = clickAmounts.ToString();
- postData["securityKey"] = GenerateSecurityKey(clickAmounts);
- webClient.UploadValues(URL, "POST", postData);
- webClient.Dispose();
- clickAmounts = 3;
- }
- private string GenerateSecurityKey(int clickAmounts)
- {
- StringBuilder sb = new StringBuilder();
- foreach (byte b in GetHash(clickAmounts.ToString()))
- sb.Append(b.ToString("X2"));
- return sb.ToString();
- }
- public static byte[] GetHash(string clickAmounts)
- {
- HashAlgorithm algorithm = SHA256.Create();
- return algorithm.ComputeHash(Encoding.UTF8.GetBytes(clickAmounts));
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement