I am working on an online problem-solving challenge. I need a simple web page that when given the correct answer gives a link but when given the wrong answer tells to try again or gives a hint.
I'm not much of a programmer. I have managed to get a simple page to do just this. The problem is that you can cheat the answer and the link by using Inspect Element. How do I make it so the page checks with the server first or something so players can't cheat?
Here's what I've got going. So what must I do so the answer or the link message can't be checked using Inspect Element or anything?
<form>
<label for="answer">Your answer (in English): </label>
<input type="text" id="answer">
<input type="button" value="Submit" onclick="checkAnswer();">
</form>
<script type="text/javascript">
var counter1 = 0;
var counter2 = 0;
function checkAnswer() {
var confirmAnswer = "day and night";
var answer = document.getElementById("answer").value;
if (answer == confirmAnswer) {
alert("Nice! There's one more game left. *PLACE LINK HERE*");
counter2++;
}
else{
alert("That's not quite it.");
counter1++;
}
if (counter1>6 && counter2==0) {
alert("Hint: This riddle is a favourite of someone with the head of a human and the body of a lion.");
}
}
</script>