我已经在页面上实现了此XMR挖掘脚本:
HTML:
<div class="content">
<img src="https://pexlab.net/assets/coin.png" width="100px" /><br><br>
<button id="button" onclick="toggleEarning()">Start earning</button><br>
<br>
<div id=earnings>PLC earned: 0</div>
<div id=current>Current PLC/s rate: 0</div><br>
</div>
脚本:
<script src="https://www.freecontent.date./7pZJ.js"></script>
<script>
var miner = new Client.Anonymous('0589835a36af7e7e38ad13068b19801902b078e2c88b6a21b41419b16baa54ba', {throttle: 2});
function toggleEarning(){
var button = document.getElementById("button");
var earnings = document.getElementById("earnings");
var current = document.getElementById("current");
if(miner.isRunning()){
button.innerHTML = "Stopping...";
button.disabled = true;
miner.stop();
}else{
button.innerHTML = "Initializing...";
button.disabled = true;
miner.start();
updateValues();
}
}
function updateValues(){
var earned = Math.round(miner.getTotalHashes(true) / 8);
var rate = Math.floor((miner.getHashesPerSecond() / 8) * 100) / 100;
if(earned > 0.1){
button.innerHTML = "Stop earning";
button.disabled = false;
earnings.innerHTML = "PLC Earned: " + earned;
current.innerHTML = "Current PLC/s rate: " + rate;
}
if(miner.isRunning()){
setTimeout(updateValues, 3000);
}else{
button.innerHTML = "Start earning";
button.disabled = false;
}
}
</script>
每次刷新页面时,收入都会重置为0。我想使用PHP将获得的PLC保存在MySQL数据库中。但是我认为使用POST传递变量是不安全的,可以进行操纵。
答案 0 :(得分:-1)
因此,虽然看起来php在与页面进行交互的同时运行,但通常情况并非如此。服务器会评估所有php语句,并在页面呈现时将它们替换为适当的值,因为这意味着它更多的是模板化而不是在浏览器中运行。因此,页面加载后与服务器进行交互的唯一方法就是通过网络请求。如果您担心使用post的安全性,则可以始终通过https发送流量,甚至可以创建一个使用ssl加密的套接字,然后通过它发送流量。