Forums / General Questions / Passing a hidden customer_id to another php file

Passing a hidden customer_id to another php file

Locked

Views: 1,823

Results 1 to 8 of 8
This thread is locked. New replies are disabled.
8 May 2009, 2:33 PM
#1
somerschool avatar

somerschool

New Zenner

Join Date:
Jan 2009
Location:
Maryland
Posts:
12
Plugin Contributions:
0

Passing a hidden customer_id to another php file

I've written a utility program to read, filter, sort, and output information from a customized table in my ZC database. I need to be able to show ALL information to customers who have bought related products, but only show SOME information to others. This means my stand-alone php file needs to know the customer_id. I don't want to pass it as a parameter, because then my logged-in customers could just copy the URL and email it to a friend and get all the privileged information. How do I give a stand-alone php file access to $_SESSION['customer_id']?

I'm using ZenCart 1.3.8a with a several add-on module and numerous amateurish custom mods.

The utility program I'm running is here

10 May 2009, 2:49 PM
#2
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Passing a hidden customer_id to another php file

Any reason not to make it a regular /page file so that you have everything available to you?

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

11 May 2009, 11:29 AM
#3
somerschool avatar

somerschool

New Zenner

Join Date:
Jan 2009
Location:
Maryland
Posts:
12
Plugin Contributions:
0

Re: Passing a hidden customer_id to another php file

No real reason. I hate to add any overhead I don't need, but computers are fast these days.

I guess I'd better go look up how to add it as a /page.

11 May 2009, 7:34 PM
#4
somerschool avatar

somerschool

New Zenner

Join Date:
Jan 2009
Location:
Maryland
Posts:
12
Plugin Contributions:
0

Re: Passing a hidden customer_id to another php file

Well, I created a /page version of my "resource list," but I didn't like what I got. I'm trying to generate a printable table. I don't need or want the store header at the top. I really just want my nice simple php file that I already have working to be able to read session variables.

This isn't really so hard, is it?

11 May 2009, 9:20 PM
#5
drbyte avatar

drbyte

Sensei

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

Re: Passing a hidden customer_id to another php file

If you want to piggy-back off the Zen Cart session data, you'll have to start the session. The easiest way to do that is to run application_top.
But, since you want to show data based on the logged-in customer details, making your script be part of a page that you've integrated into the store software would be safer and probably much more intuitive to the customer.

.
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.

11 May 2009, 9:42 PM
#6
somerschool avatar

somerschool

New Zenner

Join Date:
Jan 2009
Location:
Maryland
Posts:
12
Plugin Contributions:
0

Re: Passing a hidden customer_id to another php file

True... and I've been pondering the choice all afternoon. I hit a brick wall when I tried to put some javascript into the module page for my new /page. It didn't go smoothly.

As I read the directions, all I have to do is copy the proper *.js files into the /modules/page/MyPage directory. I did that and haven't seen any evidence that it worked. Are there any threads that cover this in more detail?

12 May 2009, 3:19 AM
#7
drbyte avatar

drbyte

Sensei

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

Re: Passing a hidden customer_id to another php file

Perhaps you missed ensuring that the filename has a "jscript_" prefix?
http://www.zen-cart.com/wiki/index.php/Customisation_-_Templates_-_Javascript

.
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.

12 May 2009, 6:35 PM
#8
somerschool avatar

somerschool

New Zenner

Join Date:
Jan 2009
Location:
Maryland
Posts:
12
Plugin Contributions:
0

Re: Passing a hidden customer_id to another php file

Truly you have a dizzying intellect.

It's looking fabulous! A valuable trick to learn for all future mods. I prostrate myself before your greatness. Someday, when I can take the pebble from your hand, I will be as smart (and helpful to strangers).