Good day everyone.
I'm after some advice/input on the best way to accomplish something with PHP.
I'm writing several PHP code segments and need to pass information that is looked up or calculated in one script to be used in a later script. I know that I could use cache to accomplish this (not exactly sure how, but I can probably figure it out). But, I'm thinking that I should probably use a session to accomplish it.
Here's what I'm doing:
1st script - A "Buy" button is pressed on either a main site or a subsite or a multi-site WP installation.
2nd script - A decision is made whether it's the main site or a subsite. The main site does not involve an affiliate, but all subsites are affiliate sites. So, as long as it's not the main, it will proceed to the affiliate scripts - otherwise, it will proceed to script #6 (which I'm not going to bore anyone with).
3rd script - Since it's been determined that it's an affiliate site that the buy button was pressed on, this script will look up the affiliate info (affiliateID - corresponds to the subsite #, affiliate PayPal email address, and the affiliate commission). This is passed to the 4th script.
4th script - This will take the affiliate commission percentage from script #3 and the item price from the specific Buy button that is pressed.
I think you get the idea. So what I need to do is pass this info from script to script while keeping it unique to the specific visitor that pressed the Buy button either on the main site or a subsite. Is this best accomplished through a Session - so that it uses a cookie to identify the site visitor all the way through the process?
Thanks for anyone's insight. If there's a better way than using a session, then I'm all ears. I read, study, and use a lot of PHP code snippets, but this is my first time doing something like this.
Athens, GA USA