hacker.org Forum Index
RegisterSearchFAQMemberlistUsergroupsLog in
Your Turn, Part Two
Goto page Previous  1, 2, 3, 4  Next
 
Reply to topic    hacker.org Forum Index » Challenges View previous topic
View next topic
Your Turn, Part Two
Author Message
MrTerry



Joined: 26 Jan 2010
Posts: 34

Post Reply with quote
hi everybody

i m new to php so it is quite a challenge for me ... all i get is "error" XD
i made a site which creates a text file whenever my url is opened with a set parameter

if get parameter is used my code searchs for a file with this name in my webspace

but it seems this challenge doesnt even tries to set or get ..... firebug doesnt seem to give me a clue
is there a tool which can show me which actions were tried?

thx
Terry
Fri Feb 05, 2010 3:46 pm View user's profile Send private message
michuber



Joined: 26 Oct 2008
Posts: 57

Post Reply with quote
MrTerry wrote:
is there a tool which can show me which actions were tried?

You should take a look at your server's access and error log.
Fri Feb 05, 2010 10:13 pm View user's profile Send private message
markobr



Joined: 20 May 2010
Posts: 17
Location: Tübingen

Post Reply with quote
Yep, to me it sends 8 requests and accepts answers in text/plain.

And just a remark from the nitpicker in me: What I write to solve this is technically not a "server" (which would listen on a port) but a CGI script (which is called by the webserver already in place).
Tue Jun 15, 2010 9:53 pm View user's profile Send private message Visit poster's website
skooli



Joined: 16 Oct 2010
Posts: 2

Post Reply with quote
For clarification: you have to remember ALL set values, not just the last one.
Sun Oct 17, 2010 11:14 am View user's profile Send private message
AMindForeverVoyaging
Forum Admin


Joined: 28 May 2011
Posts: 493
Location: Germany

Post Reply with quote
I too get the 'error' answer when submitting my solution. Here is what I get when I access my freely-hosted website manually. The real server name has been replaced by "redacted.xyz", and the displayed answer is the string within the quotation marks:

http://redacted.xyz/index.php?get=test1
answer: "no"

http://redacted.xyz/index.php?set=test1
answer: "" (empty page)

http://redacted.xyz/index.php?get=test1
answer: "yes"

http://redacted.xyz/index.php?set=test2
answer: "" (empty page)

http://redacted.xyz/index.php?get=sometext
answer: "no"

http://redacted.xyz/index.php?get=test2
answer: "yes"

Actually, what do we have to send as a reply when setting a variable? It seems to me that the challenge does not really specify that. For the 'get' this is clear, yes or no depending on whether the referenced variable has been set previously or not.

I also tried a "yes" reply instead of an empty string when setting a variable, but to no avail.
Tue Jul 26, 2011 6:23 am View user's profile Send private message
bsguedes



Joined: 24 Feb 2009
Posts: 103
Location: Porto Alegre

Post Reply with quote
I'm still stuck in this challenge, even having a script working correctly with manual testing.

I know almost nothing of PHP, does a simple " echo 'yes'; " or " echo 'no' " work to return the answer asked by the challenge ?

Would someone who solved the challenge be kind enough to test my URL if I send it via PM?

Thanks.
Tue Jul 26, 2011 7:15 pm View user's profile Send private message
AMindForeverVoyaging
Forum Admin


Joined: 28 May 2011
Posts: 493
Location: Germany

Post Reply with quote
Do you have your page hosted by a provider who allows access to the server logs? Because mine does not, at least not for free accounts. I think that this could help in finding out where things are going wrong.
Tue Jul 26, 2011 7:28 pm View user's profile Send private message
rmplpmpl



Joined: 26 Oct 2008
Posts: 113
Location: Germany

Post Reply with quote
bsguedes wrote:
I'm still stuck in this challenge, even having a script working correctly with manual testing.

I know almost nothing of PHP, does a simple " echo 'yes'; " or " echo 'no' " work to return the answer asked by the challenge ?

Would someone who solved the challenge be kind enough to test my URL if I send it via PM?

Thanks.


this should to the trick. you can PM me your URL (going to bed now, though)
Tue Jul 26, 2011 9:22 pm View user's profile Send private message
megabreit



Joined: 03 Jan 2009
Posts: 141

Post Reply with quote
In many challenges a source of pain: Did you check your output for "hidden" characters like "carriage return" or "line feed"?
Wed Jul 27, 2011 12:51 pm View user's profile Send private message
AMindForeverVoyaging
Forum Admin


Joined: 28 May 2011
Posts: 493
Location: Germany

Post Reply with quote
megabreit wrote:
In many challenges a source of pain: Did you check your output for "hidden" characters like "carriage return" or "line feed"?


Hm, while you are in general right about this being a thing to consider, I don't see how something like:

Code:

<?php

$answer = "megabreit";
print $answer;

?>


could generate unwanted characters at the end of the output, that is after the "t" in this example?
Wed Jul 27, 2011 1:35 pm View user's profile Send private message
CodeX



Joined: 17 Oct 2008
Posts: 350

Post Reply with quote
if you look at your page through something like CURL you will be able to see every byte of output, you will probably see an newline thanks to Apache/Zend being kind enough to throw in a newline at the end, I think there is a way around this that doesn't involve modifying settings
Wed Jul 27, 2011 2:06 pm View user's profile Send private message
AMindForeverVoyaging
Forum Admin


Joined: 28 May 2011
Posts: 493
Location: Germany

Post Reply with quote
Does that mean that the webserver could deliver a newline, but the browser would not display it? Fantastic. Sad
Wed Jul 27, 2011 2:26 pm View user's profile Send private message
rmplpmpl



Joined: 26 Oct 2008
Posts: 113
Location: Germany

Post Reply with quote
megabreit wrote:
In many challenges a source of pain: Did you check your output for "hidden" characters like "carriage return" or "line feed"?


Exactly this seems to be the problem of bsguedes. It was "visible" in the browser as well.

edit: i just remembered that this seems to be another difference when using echo instead of print, which is pretty odd
Wed Jul 27, 2011 3:08 pm View user's profile Send private message
AMindForeverVoyaging
Forum Admin


Joined: 28 May 2011
Posts: 493
Location: Germany

Post Reply with quote
rmplpmpl wrote:

Exactly this seems to be the problem of bsguedes. It was "visible" in the browser as well.

edit: i just remembered that this seems to be another difference when using echo instead of print, which is pretty odd


On my machine, I see no difference between:

Code:

<?php
echo "yes";
?>


and

Code:

<?php
print "yes";
?>


when saving the pages to hard disk and comparing them. Also "View Page Source" within the browser does not show any Carriage Return/Line Feed or other superfluous characters. This is on Windows XP SP3, Apache 2.2.19, PHP 5.2.17, Mozilla Firefox 3.6.18.

Now if this were platform dependent or version dependent, that would make it even worse.
Wed Jul 27, 2011 3:35 pm View user's profile Send private message
CodeX



Joined: 17 Oct 2008
Posts: 350

Post Reply with quote
If I recall you can avoid the additional newline by leaving off the closing PHP tag, I think that was the reason why the Expression Engine extensions rules state you must leave off the closing tag for extensions as the newline can cause problems when it is imported. I would still suggest you check out your pages output using something like CURL to show the response quite literally byte for byte as I remember Firefox doing stuff where newlines and maybe tabs/white space were concerned. I don't know about it's normal operation with newlines but I read on php.net that print has/does return(ed/s) a newline character if it is given a null string so may be appending a newline onto text anyway.

All that aside you should be able to manage it in the end as I did it with PHP some time ago although I appreciate config may be different but it shouldn't be too much of a problem if you a thorough.
Wed Jul 27, 2011 4:17 pm View user's profile Send private message
Display posts from previous:    
Reply to topic    hacker.org Forum Index » Challenges All times are GMT
Goto page Previous  1, 2, 3, 4  Next
Page 2 of 4

 
Jump to: 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group
Design by Freestyle XL / Flowers Online.