By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,262 Members | 1,146 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,262 IT Pros & Developers. It's quick & easy.

include code with javascript (?)

P: 13
Hello.


I am new to javascript, and need help with something:)

I came across this "hack my site"-site, and cant get past level 4 (lol);P I've got the source code:
Expand|Select|Wrap|Line Numbers
  1. <script src="JavaScript" type="Text/JavaScript"></script>
  2. <script language="JavaScript" type="Text/JavaScript">
  3. password=prompt('LEVEL: 4\n Enter password:','');
  4. if (password == haxx000r)
  5. {
  6. location.href= "?page=levels&level=4&pw=" + password; 
  7. }
  8. else 
  9. location.href= "?page=error"; 
  10. }
  11. </script>
  12.  
(the javascript part, which is the one requiring a password)
and read from the hint that i had to include code with javascript. The only thing i see in that code that could be preventing me from getting "password correct" when typing in haxx000r in the password prompt, is that the string should look like this: if(password == "haxx000r") (experience from Python). Am I right? and how do i solve this?
Mar 28 '08 #1
Share this Question
Share on Google+
2 Replies


P: 32
poe
I don't really understand what you're trying to accomplish with this piece of code, but I think I might know what's wrong (or not).

Unless haxx000r is a variable with the contents you want to compare to you are comparing the password to a variable you've just created which will have the value 'undefined'. Put quotes around it to compare to the string "haxx000r."
Mar 29 '08 #2

rohypnol
P: 54
The script you're making should probably set a value for haxx000r and then you type that exact value when asked by the "to be hacked" script.
Mar 30 '08 #3

Post your reply

Sign in to post your reply or Sign up for a free account.