1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

can a webserver tell which way round parameters are sent in an Url?

Discussion in 'General Programming Chat' started by tb303, Jun 30, 2012.

  1. tb303

    tb303 Power Member

    Joined:
    Dec 18, 2011
    Messages:
    601
    Likes Received:
    280
    not sure what section to post this in, so apologies if im in the wrong one.

    Im trying to find out can a web server tell the difference between these two example urls when it comes to accepting parameters

    hxxp://www.domainname.com/?param1="one"&param2="two"
    or
    hxxp://www.domainname.com/?param2="two"&param1="one"

    I cant see a way of telling the difference in php but i could do with some confirmation either way and if so how?

    thanks
     
  2. johndoejohndoe

    johndoejohndoe Junior Member

    Joined:
    Feb 13, 2011
    Messages:
    177
    Likes Received:
    33
    Yes, you can do this with a programming language like asp or php. It doesn't matter what order you put them in.

    In php you would do something like this to grab the variables from the url:

    Code:
    $param1 = $_GET['param1'];
    $param2 = $_GET['param2'];
    
     
  3. tb303

    tb303 Power Member

    Joined:
    Dec 18, 2011
    Messages:
    601
    Likes Received:
    280
    thanks yeah i realize how to get the variables with php etc. its just im wondering is there a way a server could check which order they are in at all.
     
  4. CodingAndStuff

    CodingAndStuff Regular Member

    Joined:
    May 6, 2012
    Messages:
    236
    Likes Received:
    84
    Occupation:
    Swagstronaut
    Location:
    You can't have my bots. Sorry :'(
    Yup! For most languages request variables are stored in an array once they are received.

    Try $_GET[0], $_GET[1], $_GET[2], etc (don't use the associative method for grabbing them) and you will see what I'm talking about.
     
    • Thanks Thanks x 1
  5. tb303

    tb303 Power Member

    Joined:
    Dec 18, 2011
    Messages:
    601
    Likes Received:
    280
    ah right. thats what i was looking for. thanks