JavaScript Challenge 5 :: Stop me quickly 2
by Arxleol on Monday 01.02.2010, under hellboundhackers.org, javascript, tutorial
Though this challange is a bit different from the second one because it stops on the same page and you have access to the javascript code:
a = prompt("Please enter password!",""); date = new Date(); year = date.getYear(); b = year+12; if(a == b){ alert("Good job! You got it!"); window.location.href=year+".php"; } else { alert("Try it again!"); }
Important thing is to notice that here we invite object Date and then obtain year by invoking function getYear(). Then we add 12 to the year and compare it to the inputted value.
Easiest way to figure out which value is b or year is using the following code in the URL line in your browser:
javascript:alert(year);
When you execute code from the previous line you will get output 110 which actually means that your password should be 122.