-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMetaTraderValidation.mq5
More file actions
100 lines (85 loc) · 2.69 KB
/
MetaTraderValidation.mq5
File metadata and controls
100 lines (85 loc) · 2.69 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
#property library
void BuildPostData(const string text, uchar &buffer[])
{
int len = StringToCharArray(text, buffer);
if(len > 0)
ArrayResize(buffer, len - 1);
}
bool Validate(string licenseKey) export
{
long account_id = (long)AccountInfoInteger(ACCOUNT_LOGIN);
string url = "https://txxcrypt-license.onrender.com/ea/validate/";
string post = "license_key=" + licenseKey + "&account_id=" + (string)account_id;
string replyHeaders;
uchar postData[];
uchar result[];
BuildPostData(post, postData);
int res = WebRequest("POST",
url,
"Content-Type: application/x-www-form-urlencoded\r\n",
10000,
postData,
result,
replyHeaders);
if(res == -1)
{
Print("WebRequest failed: ", GetLastError());
return(false);
}
string response = CharArrayToString(result);
Print("Response: ", response);
bool ok = (StringFind(response, "\"valid\":\"License is valid.\"") != -1);
return ok;
}
// void UpdateConnection(string licenseKey) export
// {
// string url = "https://txxcrypt-license.onrender.com/license/activate/";
// string post = "license_key=" + licenseKey;
// string replyHeaders;
// uchar postData[];
// uchar result[];
// BuildPostData(post, postData);
// WebRequest("POST",
// url,
// "Content-Type: application/x-www-form-urlencoded\r\n",
// 10000,
// postData,
// result,
// replyHeaders);
// }
// void UpdateDisconnect(string licenseKey) export
// {
// string url = "https://txxcrypt-license.onrender.com/license/deactivate/";
// string post = "license_key=" + licenseKey;
// string replyHeaders;
// uchar postData[];
// uchar result[];
// BuildPostData(post, postData);
// WebRequest("POST",
// url,
// "Content-Type: application/x-www-form-urlencoded\r\n",
// 10000,
// postData,
// result,
// replyHeaders);
// }
// bool Validate(string licenseKey, string productCode) export
// {
// return Validate(licenseKey);
// }
// void updateConnectionStatus(string licenseKey) export
// {
// UpdateConnection(licenseKey);
// }
// void updateHardwareId(string licenseKey) export
// {
// // Hardware ID handling not required server-side; placeholder keeps interface compatible.
// }
// void updateConnectionStatusConnected(string licenseKey) export
// {
// UpdateConnection(licenseKey);
// }
// void updateConnectionStatusDisconnected(string licenseKey) export
// {
// UpdateDisconnect(licenseKey);
// }