471,319 Members | 1,888 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,319 software developers and data experts.

Writing/Reading Custom Headers

Tell me if this can be done, and if I have a misconception here.

I am writing an app that will be served up in an app farm, and
therefore I need to move the session information to the client, not
using server-side session features. The way I have typically done this
in the ASP world was with cookies. Another way to handle this is with
a keyed record in a database, but the cookie strategy reduces the
number of times I need to hit a database, and allows me to scale the
application better by not using a database table to store session

However, I recently heard from a developer that, to get around the
restrictions on cookies, their product switched to reading and writing
custom headers. (The product, by the way, was Plumtree Corporate
Portal.) Specifically the restrictions on cookies are from the
goofball folks who install cookie security products or turn these off.
(Gee, switching to the latest Mozilla always saved me the trouble of
messing with cookie security holes.)

So, I decided to start reading and writing custom headers. I want to,
for instance, store a custom header, send a location header to
redirect to another page, and then read that custom header back.
(Imagine a login scenario where I verify login and then want to store
a user's full name in a header, then redirect them to the main menu

I guess that would mean:

$varlabel = 'FULLNAME';
$varvalue = 'Google Mike';
Header('TRACK_' . $varlabel . ': ' . $varvalue);
Header('Location: mainmenu.php'); //does a redirect

But then on mainmenu.php, when I try to read all the headers back

$headers = getallheaders();
while (list($key, $val) = each($headers)) {
echo "$key => $val<BR>\n";

....I don't see any of the TRACK_* headers I was storing. What's the
Jul 17 '05 #1
1 3807
Dang it. Looks like this article posted through Google Groups, after
all. Sorry to have posted this twice.

To be more brief, I was wondering why, when you use the header()
function to write a custom header, then redirect to another page with
header("Location: test2.php"), the getallheaders() array doesn't
return back the custom header that I wrote, but returns other browser

If you have an answer, I'd really like to know.
Jul 17 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Google Mike | last post: by
385 posts views Thread by Xah Lee | last post: by
10 posts views Thread by Jason Curl | last post: by
6 posts views Thread by _jpg_ | last post: by
5 posts views Thread by Shelly | last post: by
3 posts views Thread by Jacky | last post: by
reply views Thread by Dean Hallman | last post: by
reply views Thread by rosydwin | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.