include code with javascript (?)

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • cromoglic
    New Member
    • Mar 2008
    • 13

    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:
    Code:
    <script src="JavaScript" type="Text/JavaScript"></script>
    <script language="JavaScript" type="Text/JavaScript">
    password=prompt('LEVEL: 4\n Enter password:','');
    if (password == haxx000r)
    {
    location.href= "?page=levels&level=4&pw=" + password; 
    }
    else 
    { 
    location.href= "?page=error"; 
    }
    </script>
    (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?
  • poe
    New Member
    • Jun 2007
    • 32

    #2
    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."

    Comment

    • rohypnol
      New Member
      • Dec 2007
      • 54

      #3
      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.

      Comment

      Working...