/    Sign up×
Community /Pin to ProfileBookmark

Passing variables without $_SESSION

Hi, all,

I’m having some trouble doing something with a zencart 1.3.9 site, although the scope of the problem is not specific or related to ZC’s software.

I won’t get into the exact specifics, but I am basically trying to set a variable from one php file (that is not part of ZC) so that it can be checked from html_header.php (where I’ve added code that needs this flag to work), which is a file included in all output by zencart.

The problem seems to be that my attempts to use a (new, unique) session variable for this ($_SESSION[‘blah’] = true) are interfering with ZC’s use of $_SESSION. The variable I’m creating is getting ‘cleaned’ and is no longer a member of $_SESSION by the time ZC’s index.php finishes loading.

So where can I put a global so that ZC will leave it alone? I think the application start module called from index.php cleans out $_SESSION, $_GET and $_POST. I need a way to pass a variable that is isolated.

TIA,
Fred

to post a comment
PHP

2 Comments(s)

Copy linkTweet thisAlerts:
@WonDer9Oct 28.2011 — I think cookie will be your best bet. I can't say I could give you the specifcis on how to write it. But basically it would be separate form the site itself. Unless ZC deletes them.

There are other options:

-saving to a file.

-saving to your database

-or including a file with defined variables
Copy linkTweet thisAlerts:
@SyCoOct 28.2011 — You could write it to a file or database associated with a unique identifier.

But really you need to id where the value is getting unset and change it. They ought to have put all their session stuff in a unique key eg $_SESSION['zc']['blah'] so they could unset at the key level and not kill the whole session. A text editor with "find in files" ill help you locate how they utilize the session.
×

Success!

Help @fred_tededmonds spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...