2 Replies - 611 Views - Last Post: 04 April 2013 - 12:08 PM

#1 Zel2008  Icon User is offline

  • D.I.C Addict

Reputation: 14
  • View blog
  • Posts: 788
  • Joined: 06-January 09

Converting query strings in links

Posted 04 April 2013 - 11:14 AM

Hi all,

I just have a quick conceptual question --

If you have a group of links on a page, each of which points to a different page and has a different query string, like this:

<a href="page1?var1=zz&$var2=aa">blah</a>
<a href="page2?var1=dd">blah2</a>
<a href="page3?var1=ff&$var2=ll&$var3=ii">blah3</a>



What's the smoothest way to get rid of the query strings and convert to POST data rather than GET data? I'm going to be rewriting this application soon, and I'm concerned that sensitive information might be contained in the query strings.

Basically, these links are all connected to tabs that the user clicks on to go to another page. But, since there are sessions and user id's involved, I'm not sure it's so simple to just go to another page.

On a related note, which might render this whole thing moot -- if you're using a Perl script to generate HTML, is it generally considered a good idea to have a single script have the ability to render multiple pages? That's how these query strings originally came about.

Thanks,
Zel2008

Is This A Good Question/Topic? 0
  • +

Replies To: Converting query strings in links

#2 andrewsw  Icon User is offline

  • Fire giant boob nipple gun!
  • member icon

Reputation: 3175
  • View blog
  • Posts: 10,625
  • Joined: 12-December 12

Re: Converting query strings in links

Posted 04 April 2013 - 11:49 AM

Posting data would require a form (unless a Ajax request is made within the same page) and you could use hidden inputs to pass information between pages. However, if the query-strings only supply page or tab-numbers - that is, insignificant details - I would continue to use the query-strings. The sensitive information would be checked using session-data and a session-cookie, etc., and should definitely not by passed using the url-parameters.

It is quite common for a single script to render multiple versions of the same page. This is an efficient way to work, and reduces the number of pages you need to maintain. If the pages were significantly different, though, then this would become a bit messy and a second (or more) scripts/pages would be the way to go. [Of course, I am assuming that you are not using an MVC framework, which would render the whole question moot.]
Was This Post Helpful? 1
  • +
  • -

#3 Zel2008  Icon User is offline

  • D.I.C Addict

Reputation: 14
  • View blog
  • Posts: 788
  • Joined: 06-January 09

Re: Converting query strings in links

Posted 04 April 2013 - 12:08 PM

Thanks andrewsw,

I'd like to transition to MVC, but the application at the current moment doesn't use it.

I appreciate your explanation, though, thanks -- I'll definitely be putting sensitive IDs in cookies when I do my rewrite.

Thanks again,
Zel2008
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1