Im making a game with javascript for my website, but its easy to hack or do sql infections on it, you can also just inspect the code and change the values of any variable in the script, how can i make the script and code not viewable and editable?
Here`s my code
<script>
var scoreNumber = 0;
document.getElementById('scoreLabel').value = scoreNumber;
document.getElementById("scoreLabel").innerHTML = scoreNumber;
</script>
<html>
<style>
body{
background-image: url('snow.gif');
background-size: cover;
}
</style>
<head>
<center>
<h1 id="bottom">Cilus Networks</h1>
// Anyone can change the scrollamount, which i dont want
<marquee scrollamount="20"
direction="right"
behavior="scroll">
<a href=# onclick="add()"><img id="one" src="santa.png" height="150" width="150"></a>
</marquee>
<marquee scrollamount="20"
direction="left"
behavior="scroll">
<a href=# onclick="add()"><img id="two" src="santa.png" height="150" width="150"> <source src="plimp.mp3" type="audio/mp3"></a>
</marquee>
</center>
<h1 id="scoreLabel">0</h1>
</head>
<body>
</body>
<script>
var powerup;
var lifes;
//Anyone can change this, which i also dont want.
powerup = 0;
if (powerup == 2 ) {
function add(){
scoreNumber = scoreNumber +1000
document.getElementById('scoreLabel').value = scoreNumber;
document.getElementById("scoreLabel").innerHTML = scoreNumber;
}
};
if (powerup == 5 ) {
function add(){
scoreNumber = scoreNumber +500
document.getElementById('scoreLabel').value = scoreNumber;
document.getElementById("scoreLabel").innerHTML = scoreNumber;
}
};
function add(){
scoreNumber = scoreNumber +1
document.getElementById('scoreLabel').value = scoreNumber;
document.getElementById("scoreLabel").innerHTML = scoreNumber;
setInterval(function(){ window.location.replace("http://cilusnetworks.com/thankyouMDT.php"); }, 400);}
</script>
Any ideas on how to do this? I have done som research but i cant seem to find anything..