Curious about something
I was trying to solve this level without doing the math… I tried something and I dont really get what I’m doing wrong.
So the code looks like this :
if (condition):
grant access
else
dont grant access.
I changed it to if(not condition)
using firebug and tried entering a random password it didnt work .
Can i get a hint please ? I really want to do this without the math :P
```<?php
$hi = ‘Hello world’;
if($hi === ‘Hello world’) {
// Then there’s no matter if you do echo $hi; or echo ‘Hello world’; right? :)
}
?>```
# Don't let anyone tell you that you're too young to accomplish something, a baby shark, is still a fucking shark.
Well It’s always gonna print a Hello world if you put it …
Which is why i thought that if i change the code to
if ( !condition):
grant access
else:
dont grant
so now if i input a random password that wont match the condition i will still get access..
or not ?
The thing is that I’m challenged to make these levels without learning javascript :P but basic programming knowledge can work here.
It doesn’t work because this.
...
{ document.location = "2?x=" + length; } ```
[u]
*2?x=+lenght[/u] is going to redirect you to the page that'll tell you "successful level". you know?*
<?php
$lenght = ‘Something’;
$password = $_POST[“password”];
if($password == $lenght){
header('Location: nextpage'.$password.'.php');
}else{
echo "Dawg, your password isn't correct!";
?>
```
well, if you know about programming you should know what’s going on when you’re changing the code in something like
if($password != $lenght){
Yeah, you’re right, everything except what “lenght” means, it going to be the right one, but then you’ll be redirect to something like * “nextpage(whatyoutypedhere).php” * , and that’s not the right page.
# Don't let anyone tell you that you're too young to accomplish something, a baby shark, is still a fucking shark.
Oh okayyy deal so i need to redirect to what it actually is not what i typed…
see I didnt understand the redirection part :P
Thanks a lot!
I guess i got it now
Yep tho, what I wanted to say you with my first post is that you don’t need to follow all those variables, if the total is in one of them, just print it.
# Don't let anyone tell you that you're too young to accomplish something, a baby shark, is still a fucking shark.
Tbh i dont know how to print variables in java :P
As I said i have general knowledge about programming, some object oriented using c++ but not java :P
So I was figuring out the syntax from reading the code , but unfortunately there was no print syntax in the source :P
EDIT: Well i looked out how to print the password since changing the code didn’t work …
Probably need to understand java more…
The correct way to output something to stdout in java is using
System.out.println("Hello Word!");
It adds an extra line feed character to your string, use the print method if you don’t want it.
As @feuerstein pointed out, you are probably mistaking java and javascript. They are two very different languages. The correct way to output something in javasccript is using
Console.log("Hello World!");
Again, it adds an extra line feed at the end. The output is either printed in the browser’s console or to stdout in Node.js .
Javascript and java syntax may seem similar, but they serve two different purposes and use two different syntax. Have a look at this .