Your Turn, Part Two

User avatar
bsguedes
Posts: 103
Joined: Tue Feb 24, 2009 12:39 am
Location: Porto Alegre

Post by bsguedes »

Hey guys, I solved it.

Thanks to everyone who posted. The error? A newline character AFTER the last '>'
I was worried checking the code and trying different string functions and the answer was always there.

However, the browser didn't show the newline, only when looking in the source code of the webpage.

Well, thanks again :D
AMindForeverVoyaging
Forum Admin
Posts: 496
Joined: Sat May 28, 2011 9:14 am
Location: Germany

Post by AMindForeverVoyaging »

Well, glad that bsguedes solved it :)
Mine still don't work :(

Could anybody recommend to me a webspace provider which does allow access to the server logs on their free accounts?
DaymItzJack
Posts: 106
Joined: Thu Oct 29, 2009 9:21 pm

Post by DaymItzJack »

Generally if you have a friend with a server or hosting, they can give you some space. If you cannot find anyone else, I'd be happy to host a .php file for you just to solve this challenge. Send me a PM if you're interested.
c0mp4ct
Posts: 3
Joined: Sat Oct 16, 2010 11:58 pm

Post by c0mp4ct »

Code: Select all

0000000: 6e6f 0a       no.
Any hint for me to remove 0a? echo "no" is in the file.
DaymItzJack
Posts: 106
Joined: Thu Oct 29, 2009 9:21 pm

Post by DaymItzJack »

c0mp4ct wrote:

Code: Select all

0000000: 6e6f 0a       no.
Any hint for me to remove 0a? echo "no" is in the file.
I'm confused as what you're even trying to do.
megabreit
Posts: 141
Joined: Sat Jan 03, 2009 3:33 pm

Post by megabreit »

All depends on your internet connection. I ran a web server on my local PC and (temporarily) forwarded the port through my DSL router. Dyndns will be a big help with this setup...
This way you have access to the logs and can experiment.

And BTW: One doesn't have to use PHP to solve this challenge. Other languages are more flexible for this actual purpose :-)
User avatar
CodeX
Posts: 350
Joined: Fri Oct 17, 2008 5:28 pm

Post by CodeX »

as for c0mp4ct I think the simulation to your problem will probably will be my post on the bottom of the last page. i.e. how to avoid the '\n' with PHP
AMindForeverVoyaging
Forum Admin
Posts: 496
Joined: Sat May 28, 2011 9:14 am
Location: Germany

Post by AMindForeverVoyaging »

megabreit wrote:All depends on your internet connection. I ran a web server on my local PC and (temporarily) forwarded the port through my DSL router. Dyndns will be a big help with this setup...
This way you have access to the logs and can experiment.
I think I'll try that. I have no idea why this challenge must be so much trouble, especially for the rather simple thing it is asking for. Nevertheless your suggestion seems like a good a way to get a fully-accessible web server.
markobr wrote:Yep, to me it sends 8 requests and accepts answers in text/plain.
Actually, does it have to be text/plain? When I use curl, I see the following:
<= Recv header, 25 bytes (0x19)
0000: 43 6f 6e 74 65 6e 74 2d 54 79 70 65 3a 20 74 65 Content-Type: te
0010: 78 74 2f 68 74 6d 6c 0d 0a xt/html..
EDIT: Answering my own question: At least setting the header explicitly to 'Content-Type: text/plain' does not fix it... at least not on its own. Might still be necessary to do it, or it might not.
megabreit
Posts: 141
Joined: Sat Jan 03, 2009 3:33 pm

Post by megabreit »

Maybe it's time to read the challenge text again? And maybe again... Can you show me the line where it says what content type to use? :roll:
AMindForeverVoyaging
Forum Admin
Posts: 496
Joined: Sat May 28, 2011 9:14 am
Location: Germany

Post by AMindForeverVoyaging »

It is not specified, just like the answer when SETting a variable. Which might be where the problem lies. Or it might not. How am I supposed to know when I haven't found out yet? :roll:
megabreit
Posts: 141
Joined: Sat Jan 03, 2009 3:33 pm

Post by megabreit »

This is why it's called "challenge" :-)
DaymItzJack
Posts: 106
Joined: Thu Oct 29, 2009 9:21 pm

Post by DaymItzJack »

I don't see why anyone would have trouble with this challenge. All you need is basic programming skills and a server. Did I just have it easy when I did it? My code is literally 7 lines long and worked first time.
AMindForeverVoyaging
Forum Admin
Posts: 496
Joined: Sat May 28, 2011 9:14 am
Location: Germany

Post by AMindForeverVoyaging »

DaymItzJack wrote:I don't see why anyone would have trouble with this challenge.
Did you read the whole thread? ;)
DaymItzJack wrote:All you need is basic programming skills and a server. Did I just have it easy when I did it? My code is literally 7 lines long and worked first time.
The problem might be not in the program logic itself, but in the setup/configuration. At least that seems like a not-so-unlikely explanation for the script arguably working fine when being accessed manually.
AMindForeverVoyaging
Forum Admin
Posts: 496
Joined: Sat May 28, 2011 9:14 am
Location: Germany

Post by AMindForeverVoyaging »

Phew, finally made it.

Hint: If you do this challenge in PHP then don't use $_SESSION variables - they need enabled cookies for the standard approach (which just about every website on the planet uses) to work. To be honest, I find it a bit strange that we are supposed to use cookies in other challenges (e.g. 'Type Fastest'), but here they are most likely not supported...
megabreit
Posts: 141
Joined: Sat Jan 03, 2009 3:33 pm

Post by megabreit »

What makes you think that there is only 1 valid way of setting up a web server?? I hope you learned that there is no such 1 way! One goal of all these challenges is to learn! Especially with hacker.org there is everything valid and appropriate that makes you find the solution... even the strangest thing. And if the challenge is setup to not use cookies or even gets confused by cookies... so what? Find out a way to do it within the present environment! Strange is normal and no reason to complain :shock:
Post Reply