-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtext.php
158 lines (132 loc) · 5.07 KB
/
text.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
<?php
require "app/Apis/database/DataBase.php";
if (!DataBase::is_login()) {
header('location:login');
}
function TestBlockHTML($price)
{
ob_start();?>
<html>
<body>
<strong>Transfer: </strong><label><?php
$pr=DataBase::USDtoBTC($price);
echo $pr . " :BITCOIN";
?></label>
<br><br>
<strong>TO: </strong><label><?php
$respons = DataBase:: generateAddress();
echo $respons;
DataBase::createInvoice($pr,$respons );
echo("<br>");
echo("<br>");
?> Address</label>
<br>
<img src="<?php echo DataBase::generateQR($respons); ?>" alt="">
<br>
<p> You Have:( <label style="font-weight: bold;" id="demo"></label> ) : To make payment</p>
<br>
<label id="mess">
<?php
$status= DataBase::getStatus();
if ($status == 0) {
$status = "<span style='color: orangered' id='status'>PENDING</span>";
$info = "<p>You payment has been received. Invoice will be marked paid on two blockchain confirmations.</p>";
} else if ($status == 1) {
$status = "<span style='color: orangered' id='status'>PENDING</span>";
$info = "<p>You payment has been received. Invoice will be marked paid on two blockchain confirmations.</p>";
} else if ($status == 2) {
$status = "<span style='color: green' id='status'>PAID</span>";
} else if ($status == -1) {
$status = "<span style='color: red' id='status'>UNPAID</span>";
} else if ($status == -2) {
$status = "<span style='color: red' id='status'>Too little paid, please pay the rest.</span>";
} else {
$status = "<span style='color: red' id='status'>Error, expired</span>";
}
echo $status;
?>
</label>
<br>
<button id="verify" type="button">Confirm</button>
<script src="js/jq.js"></script>
<script>
// Set the date we're counting down to
$(document).ready(function() {
const url = 'app/Apis/api.php'
$("#verify").click(function() {
$.ajax({
type: "POST",
url: url,
data: {
action: "comfirmbtc",
},
// dataType: "dataType",
success: function(response) {
console.log(response);
if (response == 1) {
$("#mess").html(
"<span style='color: orangered' id='status'>PENDING</span> <br> <p>You payment has been received. Invoice will be marked paid on two blockchain confirmations.</p>"
);
} else if (response == -1) {
$("#mess").html(
"<span style='color: red' id='status'>UNPAID</span> "
);
} else if (response == 0) {
$("#mess").html(
"<span style='color: orangered' id='status'>PENDING</span> <br> <p>You payment has been received. Invoice will be marked paid on two blockchain confirmations.</p>"
);
} else if (response == 2) {
$("#mess").html(
"<span style='color: orangered' id='status'>PAID</span>"
);
window.location.replace="buysell";
} else if (response == -2) {
$("#mess").html(
"<span style='color: red' id='status'>Too little paid, please pay the rest.</span>"
);
} else {
$("#mess").html(
"<span style='color: red' id='status'>Error, expired</span>"
);
}
}
});
})
});
var countDownDate = new Date(new Date().getTime() + 11 * 60000);
// Update the count down every 1 second
var x = setInterval(function() {
// Get today's date and time
var now = new Date().getTime();
// Find the distance between now and the count down date
var distance = countDownDate - now;
// Time calculations for days, hours, minutes and seconds
var days = Math.floor(distance / (1000 * 60 * 60 * 24));
var hours = Math.floor((distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
var minutes = Math.floor((distance % (1000 * 60 * 60)) / (1000 * 60));
var seconds = Math.floor((distance % (1000 * 60)) / 1000);
// Output the result in an element with id="demo"
document.getElementById("demo").innerHTML = minutes + "m " + seconds + "s ";
// If the count down is over, write some text
if (distance < 0) {
clearInterval(x);
document.getElementById("demo").innerHTML = "Expired"
window.location.href = "check";
}
}, 1000);
</script>
</body>
</html>
<?php
return ob_get_clean();
}?>
<?php
if ($_SERVER["REQUEST_METHOD"] == "POST") {
$price = $_REQUEST['price'];
if (!empty($price)) {
echo TestBlockHTML($price);
} else {
echo "<h1>invalid amount</h1>";
}
}
?>