If this is your first visit, check our documentation. To post, register or login.
Forums / Code Collaboration / Recommended method to capture GET parameters?

Recommended method to capture GET parameters?

Started by lsb57 on 17 Jan 2013, 9:03 PM · Views: 3,087

Results 1 to 7 of 7
17 Jan 2013, 9:03 PM
#1
lsb57 avatar

lsb57

New Zenner

Join Date:
Oct 2012
Posts:
9
Plugin Contributions:
0

Recommended method to capture GET parameters?

All,

What's the best way to capture a GET parameter passed when the main page is invoked similarly to http://site.here/index.php?main_page=index&a_parameter=some_value

One way is to add a section to application_top.php, like this:

if ( isset($_GET["a_parameter"]) )
{
$_SESSION["a_parameter"] = $_GET["a_parameter"];
setcookie("a_parameter", $_GET["a_parameter"], time() + 606024*3, "/");

}

While this works, it makes upgrades more complicated. Is there a better way, maybe in the form of attaching to a notification message? If I can keep the code outside of the standard application_top.php, upgrade would be simpler.

Thanks!

17 Jan 2013, 9:09 PM
#2
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,512
Plugin Contributions:
176

Re: Recommended method to capture GET parameters?

Lets back up WAY BACK TO THE BEGINNING.

What are these GET parameters for anyway? What's the bigger picture business issue you're trying to address?
What code are these GET parameters coming from?
What exactly do yo mean by "method to capture"? Why are you trying to "capture"? What are you doing with this information? Why are you putting it into a session variable?
It sounds like you're trying to alter custom code ... but haven't said what this custom code does.

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

17 Jan 2013, 9:50 PM
#3
lsb57 avatar

lsb57

New Zenner

Join Date:
Oct 2012
Posts:
9
Plugin Contributions:
0

Re: Recommended method to capture GET parameters?

It's affiliate related. I want to know which site referred my store. So the referring site will use a parameter in their link to my site - I need to capture that so I can track what orders are associated with the referral.

17 Jan 2013, 10:06 PM
#4
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,512
Plugin Contributions:
176

Re: Recommended method to capture GET parameters?

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

17 Jan 2013, 10:33 PM
#6
lsb57 avatar

lsb57

New Zenner

Join Date:
Oct 2012
Posts:
9
Plugin Contributions:
0

Re: Recommended method to capture GET parameters?

On a second thought - is the global $db available at this stage? Say I want to have a configuration group for the autoloader?

17 Jan 2013, 10:43 PM
#7
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,512
Plugin Contributions:
176

Re: Recommended method to capture GET parameters?

No .

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.