|
Posted by Gordon Burditt on 02/08/07 03:51
>I don't know how to make this any clearer. I never ever ever ever ever
>want the PHP code to create any type of cookie, ever. I just want it
So what does create the cookie? Yeah, I know, "manually". So how
do you create a cookie "manually"? To me this suggests disassembling
the hard disk and waving a magnet over it VERY CAREFULLY to alter
code in the browser. Or pointing a laser by hand at a CD-RW blank to
burn a patch file.
>to read the cookie, which I will create manually and place it in a
>directory where the form can access it.
If you create it manually (which is NOT done from the server), there
is no such thing as "where the form can access it". A browser
usually stores persistent cookies in a file. Or perhaps in the
registry. Where that file is and what format it's in will vary
with the browser and perhaps the browser version. In most browsers
I have seen, the format is not that difficult to figure out. Oh,
yes, *CLOSE* all instances of the browser, edit the file, and then
restart it. Otherwise your changes may get lost.
>Just as in any other language,
>you can open a file outside the program and read its contents. That is
But browsers do not store cookies in individual files in arbitrary
places in the filesystem.
>all I am trying to accomplish here. Think of a C++ program that opens
>a file name text.txt. The program doesn't have to create the file
>first to open it and read it, the file just simply has to exist at the
>specified location.
Servers do not "open" cookies to read them. If cookies are sent
by the browser, they end up in $_COOKIE. If cookies are not sent,
they DON'T end up in $_COOKIE. Oh, yes, whether cookies are sent
or not depends on the domain of the cookie matched against the
domain of the server, and whether the browser takes cookies at all,
and, of course, whether the cookie is set in the browser.
It seems to me it would be a lot simpler to have a special PHP page,
perhaps accessable only by an admin and protected by a password,
called "CHANGE MY PRINTER". Its function is to read the form input
on which the admin has selected the correct printer, and set the
"printer" cookie to whatever the admin requested (using setcookie()).
Go to each workstation. Visit the form once for each workstation,
setting the appropriate printer. Once done, you're set, (you've
done all the "manually" work) and you never have to use that page
again, unless the cookie gets lost due to hard disk failure, OS
upgrade, users clearing cookies, someone installs a different
browser, etc.
Navigation:
[Reply to this message]
|