You are here: Re: Reading a cookie « PHP Programming Language « IT news, forums, messages
Re: Reading a cookie

Posted by Jerim79 on 02/07/07 16:41

On Feb 7, 10:17 am, Jerry Stuckle <jstuck...@attglobal.net> wrote:
> Jerim79 wrote:
> > On Feb 6, 3:50 pm, Jerry Stuckle <jstuck...@attglobal.net> wrote:
> >> Jerim79 wrote:
> >>> I did try to find the answer to this before posting, so this isn't a
> >>> knee jerk reaction.
> >>> What I am trying to accomplish is to have a script that opens a
> >>>cookie, reads a value, and then use a switch/case to take action based
> >>> on that value in thecookie. I want to set thecookiemanually, so I
> >>> don't need setcookie(). I see that in PHP it stores thecookiein
> >>> memory. Is there a way to have PHP just read acookiefrom the desktop
> >>> machine? Does it have to set it first? Am I better off with Javascript
> >>> for this?
> >>> The situation is that we have 4 computers. We also have 4 different
> >>> types of specialty printers, each for a different function. We don't
> >>> know which computer will be hooked up to which printer, and they may
> >>> be switched out routinely. We are trying to develop a simple script
> >>> that reads the value of thecookiewhich tells it which printer to
> >>> print to and what to print. This way, we can easily switch computers
> >>> around as needed, and will only need to change the value in thecookie
> >>> to have it access the correct code so that it prints the correct
> >>> information in the correct format.
> >> You can use acookiefor this. But here's a suggestion - have a
> >> password-protected admin page which sets thecookie. When they move the
> >> computer, they have to log into the admin page and tell it which printer
> >> to use.
>
> >> This then sets thecookie, which is now available for the rest of your
> >> pages. Of course, you would want to ensure that cookies are not cleared
> >> when the browser shuts down - at least not for your site.
>
> >> --
> >> ==================
> >> Remove the "x" from my email address
> >> Jerry Stuckle
> >> JDS Computer Training Corp.
> >> jstuck...@attglobal.net
> >> ==================
>
> > I talked with my boss, and he is completely against the kiosk mode
> > (for whatever reason). Let's step back from the wordcookiefor a
> > minute.
>
> > We are going to have 4 "kiosk" style computers, each of which display
> > the same registration form on a remote server. As the customer fills
> > out the form, he may get redirected to other forms based on how he
> > answered (Multiple paths). The very last step for everyone, after
> > everything is filled out and the customer submits the form, we want to
> > have a small script on the server that accesses a file on the kiosk
> > computer. The script on the server will read the value and perform an
> > action based on that value.
>
> A problem here. The server cannot read a file on the client system.
> This would be a huge security risk if it could be done.
>
> >Cookieis the word my boss threw out there. I don't see why it has to
> > be acookie, if PHP can access a remote file on the "kiosk" machine
> > from the server. We don't want to pass the value with the URL, as he
> > would have to go back and change all the pages of the PHP form to
> > pickup the value and pass it along to the next page.
>
> It about has to be acookiebecause security prevents anything on the
> server from reading anything on the client not sent directly by the
> browser. And javascript cannot access files on the client computer, either.
>
> Can you imagine what fun the hackers would have if there were a way to
> read files on your computer when you visit a website?
>
> So you're pretty much stuck with acookieif you want something specific
> to that machine.
>
> --
> ==================
> Remove the "x" from my email address
> Jerry Stuckle
> JDS Computer Training Corp.
> jstuck...@attglobal.net
> ==================

Okay, so we are going with cookies. The problem I have is that I don't
know how to make PHP just read a cookie. I understand how to set a
cookie, and it is stored in memory, which then can be used throughout
the form. I even know how to set a time limit on a cookie to make it
stay on the kiosk computer, but again, we don't want to create the
cookie.

The problem is that I don't want to set a cookie. I want to just read
one that I create manually. Obviously, setting a cookie through our
PHP form would only be able to set one value for all four machines,
yet we want to have 4 different values. Is there a way to just read a
cookie without setting it through PHP?

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация