-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathJetCrypto.php
223 lines (185 loc) · 7.56 KB
/
JetCrypto.php
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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
<?php
$trxadress = "TUz2LvQsWr3wCBdwDGhwAV6FNBADKQ4npH";
$btcadress = "BBBBBBBBBBBBBBBBB";
$ethadress = "CCCCCCCCCCCCCCCCC";
$usdtadress = "DDDDDDDDDDDDDDDDDD";
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Pay with Crypto</title>
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
<style>
.crypto-option img {
width: 30px;
height: 30px;
object-fit: cover;
border-radius: 50%;
margin-right: 10px;
}
</style>
</head>
<body>
<div class="container mt-5">
<div class="row">
<div class="col-md-6 offset-md-3">
<div class="card">
<div class="card-header bg-warning text-white">
<div class="row">
<center>
<h4 class="mb-0"><img src="cyrptopay.svg" /></h4>
</center>
</div>
</div>
<div class="card-body">
<div id="trxInfoDiv">
<div class="mb-3" id="slctcry"><center>
<label for="cryptoSelect" class="form-label">Select Cryptocurrency</label>
<div class="dropdown">
<input class="btn btn-danger dropdown-toggle" type="button" id="cryptoDropdown" value="Tron (TRX)" data-bs-toggle="dropdown" aria-expanded="false">
<ul class="dropdown-menu" aria-labelledby="cryptoDropdown">
<li><a onclick="selectCrypto('btc')" class="dropdown-item crypto-option" href="#" data-crypto="btc"><img src="btc.png" alt="Bitcoin"> Bitcoin (BTC)</a></li>
<li><a onclick="selectCrypto('eth')" class="dropdown-item crypto-option" href="#" data-crypto="eth"><img src="eth.png" alt="Ethereum"> Ethereum (ETH)</a></li>
<li><a onclick="selectCrypto('trx')" class="dropdown-item crypto-option" href="#" data-crypto="trx"><img src="trx.png" alt="Tron" selected> Tron (TRX)</a></li>
<li><a onclick="selectCrypto('usdt')" class="dropdown-item crypto-option" href="#" data-crypto="usdt"><img src="usdt.svg" alt="Tether"> Tether (USDT)</a></li>
</ul>
<input type="hidden" name="crypto" id="selectedCrypto">
</div>
</center>
</div>
<div id="hashInputDiv" style="display: none;">
<center><div id="countdown" class="mt-3">Loading..</div></center>
<hr />
<div class="mb-3">
<label for="hash" class="form-label">Transaction Hash:</label>
<input type="text" class="form-control" id="hash">
</div>
<button type="button" class="btn btn-success" onclick="Complete()">Complete</button>
</div>
<div id="CryBody">
<script>
let cryptoType = "TRX";
let amount = 50;
let SelectedWalletAdress = "<?php echo $btcadress ?>";
let ApiLink = "http://localhost/s-client/JetCrypto/api.php";
let countdown;
function copyToClipboard(elementId) {
var element = document.getElementById(elementId);
element.select();
document.execCommand("copy");
Swal.fire({
title: "Copied",
text: "Copied => " + element.value + " ",
timer: 500,
icon: "success"
});
}
function startCountdown() {
let timeLeft = 300; // 5 minutes in seconds
countdown = setInterval(function () {
let minutes = Math.floor(timeLeft / 60);
let seconds = timeLeft % 60;
document.getElementById('countdown').innerText = `${minutes}:${seconds}`;
if (timeLeft <= 0) {
clearInterval(countdown);
document.getElementById('countdown').innerText = "Time's up!";
}
timeLeft -= 1;
}, 1000);
}
function showHashInput() {
startCountdown();
var trxInfoDiv = document.getElementById('CryBody');
if (!trxInfoDiv) {
trxInfoDiv = document.createElement('div');
trxInfoDiv.id = 'CryBody';
document.getElementById('trxInfoDiv').appendChild(trxInfoDiv);
}
trxInfoDiv.innerHTML = ""; // Clear other fields
var hashInputDiv = document.getElementById('hashInputDiv');
if (!hashInputDiv) {
console.error('hashInputDiv element not found.');
return;
}
document.getElementById("slctcry").style.display = 'none';
hashInputDiv.style.display = 'block';
}
function Complete() {
clearInterval(countdown);
var hash = document.getElementById("hash").value;
const url = `http://localhost/s-client/JetCrypto/api.php?request=CheckTransaction&amount=${amount}&hash=${hash}`;
// Fetch ile HTTP isteği gönderme
fetch(url)
.then(response => response.json()) // Gelen veriyi JSON formatına çevirme
.then(data => {
// Gelen veriyi kontrol etme
if (data.Status === "SUCCESS") {
Swal.fire({
title: "Verified",
text: "Your " + cryptoType + " has been successfully received.",
icon: "success"
});
} else {
Swal.fire({
title: "Error",
text: data.Message,
icon: "error"
});
}
})
.catch(error => {
console.error("İstek hatası:", error);
});
}
function selectCrypto(crypto) {
if (crypto == 'btc') {
document.getElementById("cryptoDropdown").value = "Bitcoin (BTC)";
SelectedWalletAdress = "<?php echo $btcadress ?>";
cryptoType = "BTC";
} else if (crypto == 'eth') {
document.getElementById("cryptoDropdown").value = "Ethereum (ETH)";
SelectedWalletAdress = "<?php echo $ethadress ?>";
cryptoType = "ETH";
} else if (crypto == 'trx') {
document.getElementById("cryptoDropdown").value = "Tron (TRX)";
SelectedWalletAdress = "<?php echo $trxadress ?>";
cryptoType = "TRX";
} else if (crypto == 'usdt') {
document.getElementById("cryptoDropdown").value = "Tether (USDT)";
SelectedWalletAdress = "<?php echo $usdtadress ?>";
cryptoType = "USDT";
} else {
document.getElementById("cryptoDropdown").value = "Choose Cryptocurrency";
}
document.getElementById("CryBody").innerHTML = `
<div class="mb-3">
<label for="trxAddress" class="form-label">Recipient ${cryptoType} Address:</label>
<div class="input-group">
<input type="text" class="form-control" id="trxAddress" value="${SelectedWalletAdress}" readonly>
<button class="btn btn-outline-secondary" type="button" onclick="copyToClipboard('trxAddress')">Copy</button>
</div>
</div>
<div class="mb-3">
<label for="trxAmount" class="form-label">Amount to Send (${cryptoType}):</label>
<div class="input-group">
<input type="text" class="form-control" id="trxAmount" value="${amount}" readonly>
<button class="btn btn-outline-secondary" type="button" onclick="copyToClipboard('trxAmount')">Copy</button>
</div>
</div>
<button type="button" class="btn btn-success" onclick="showHashInput()">Sent</button>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
`;
}
</script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
</body>
</html>