Question about passing parameters via URL for basic missions

A place where newbies can post without (much) fear of reprisal. All mission posts should still go in the applicable forum.
Forum rules
Older HTS users: Be nice to the new people.

NEW USERS: This is NOT the place to post about missions! Refer to "Missions" category.

Question about passing parameters via URL for basic missions

Post by JediZavv on Mon Apr 09, 2012 4:01 am
([msg=65554]see Question about passing parameters via URL for basic missions[/msg])

Greeting folks,

I'm new to HTS, and I'm currently working on the Basic Mission;
Yet, at this very beginning moment, I cannot start new topic in Basic zone;
so here's the question:

Why passing parameters via URL in basic mission does not work??
i.e. http://www.hackthissite.org/missions/ba ... ssword=abc
this does not redirect you to the page with error msg just as you type abc into the box and click submit;
to my understanding, they should function exactly the same, but apparently, they aren't,
index.php?password=abc != type "abc" into textfield and click "submit" ??????!?!?!?
WHY?

JediZavv
JediZavv
New User
New User
 
Posts: 3
Joined: Mon Apr 09, 2012 3:32 am
Blog: View Blog (0)


Re: Question about passing parameters via URL for basic missions

Post by tremor77 on Mon Apr 09, 2012 9:21 am
([msg=65555]see Re: Question about passing parameters via URL for basic missions[/msg])

Because passing parameters to that page via URL isn't part of the mission test. If that is how you're trying to solve the mission then you are terribly overthinking it. Also that page is a POST processor...not a GET processor.. so passing data via URL is useless, you need to pass that data via a form post.
Image
User avatar
tremor77
Moderator
Moderator
 
Posts: 780
Joined: Wed Mar 31, 2010 12:00 pm
Location: New York
Blog: View Blog (0)


Re: Question about passing parameters via URL for basic missions

Post by JediZavv on Mon Apr 09, 2012 12:39 pm
([msg=65560]see Re: Question about passing parameters via URL for basic missions[/msg])

tremor77 wrote:Because passing parameters to that page via URL isn't part of the mission test. If that is how you're trying to solve the mission then you are terribly overthinking it. Also that page is a POST processor...not a GET processor.. so passing data via URL is useless, you need to pass that data via a form post.


sorry, but I don't quite get the part whether the parameter is processed by GET or POST
I mean, if the form's method is POST, aren't the parameter fields within this form are all processed by POST;
similarly, if the form's method is GET, won't the parameter fields within the form be processed by GET?
so doesn't that mean the parameters one passes via the URL won't be all processed by solely GET but
based on the form's method its parameter field is located?

-- Mon Apr 09, 2012 11:22 am --

I found the answer, and it actually involves some not obvious difference between JAVA and PHP/HTML
as I start web programming in JAVA, and HttpServletRequest.getParameter() can just get all the parameters no matter
the parameters arrive in the query string or request body;

i.e.
using URL like ?password=abc, abc arrive as query string and can only be retrieve via $_GET['password']; and
typing abc into a password field then click submit will pass the parameter to the request body, which can only be retrieve via $_POST['password']

this problem doesn't exist in JAVA, servlet/JSP, which is why I couldn't notice why simply passing parameter via URL does not work the same as passing via the fields and submit.
JediZavv
New User
New User
 
Posts: 3
Joined: Mon Apr 09, 2012 3:32 am
Blog: View Blog (0)


Re: Question about passing parameters via URL for basic missions

Post by tremor77 on Tue Apr 10, 2012 11:08 am
([msg=65570]see Re: Question about passing parameters via URL for basic missions[/msg])

*Mind Blown*

In PHP there are 2 methods. GET and POST.

GET method uses URL's to pass information to the page. index.php?var1=something&var2=somethingelse

POST method uses a form submit and POST Processing script.

http://thinkvitamin.com/code/the-definitive-guide-to-get-vs-post/

Plus for Mission #1 --- entirely way over the top.
Image
User avatar
tremor77
Moderator
Moderator
 
Posts: 780
Joined: Wed Mar 31, 2010 12:00 pm
Location: New York
Blog: View Blog (0)


Re: Question about passing parameters via URL for basic missions

Post by mShred on Sat Apr 14, 2012 11:25 am
([msg=65682]see Re: Question about passing parameters via URL for basic missions[/msg])

Op, you ARE terribly overthinking this problem... Agreed with tremor, *mindblown*
Image

For those about to rock.
User avatar
mShred
Administrator
Administrator
 
Posts: 1477
Joined: Tue Jun 22, 2010 4:22 pm
Blog: View Blog (2)



Return to NZone

Who is online

Users browsing this forum: No registered users and 0 guests