First of all, I never studied javascript… now that I think of it I just kinda “know” programing languages (strange but thats not the point).
So I see this script:
[/spoiler ]
And as a logical person I see that it looks like php, a language I happen to know quite well. So I dissect it:<!-
var thecode = ‘code123’;[/spoiler]
this gives me the thought that it is the password itself but cannot be sure.<!-
(function(){ $(‘.level-form’).submit(function(e){ e.preventDefault();[/spoiler]
This line, I assume this is meant to detect when I press the “submit” button and trigger the script.[spoiler]
if ($(‘.level-form #pass’)[0].value == thecode)
This one is quite obvious, if the password I entered is thecode or in other words “code123”
[spoiler]
{ document.location = “?pass=” + thecode; } else { alert(‘Incorrect Password’); } }); }); -!>
If the above is true than I should be forwarded to ?pass=code123 but instead I just get the error alert.
[spoiler]
So I tried making the GET request manually but no luck
https://www.hackthis.co.uk/levels/javascript/3?pass=code123
-!>
What did I do wrong?!?!
Well, what you did wrong is to spoil this level. Please edit your post by using spoiler tag like this:
[ spoiler ]Your spoiler goes here.[ /spoiler ] (Please remember to remove the spaces!)
About your problem: Have you ever heard about overriding a variable?
To tag people just use the “@” symbol, just make sure to write their whole name so that it tags them.
@Codex561 who said you need to override the variable?
@holographic freewind1012 did or implied that I need to do so.
I just do not see what I am doing wrong :s
@Codex561: Well, I did not say that you needed to override a variable. The variable has already been overridden.
@freewind1012 Um ok I just solved but it is still confusing….
Thecode is getting set to “code123”, why is the password not “code123”?
var thecode = ‘code123’;
And where does the password pop out of, I do not see it anywhere in the sourcecode
@holographic so it was there just to throw people off?