469,310 Members | 2,750 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,310 developers. It's quick & easy.

include code with javascript (?)

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
2 1406
poe
32
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
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.

Similar topics

21 posts views Thread by Peter Bassett | last post: by
4 posts views Thread by Jeremy | last post: by
6 posts views Thread by Jamie | last post: by
5 posts views Thread by Tony Strazzeri | last post: by
2 posts views Thread by William van Zwanenberg | last post: by
9 posts views Thread by skijor | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by harlem98 | last post: by
reply views Thread by harlem98 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.