English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

5 answers

The use of cookies has very little to do with PHP. Like other web development languages PHP allow you to set cookies, and read them, although this is really instrinsic to the webserver itself.

The reason that cookies were invented, is that the HTTP protocol wasn't designed to provide session. When a page is requested the server returns the data and terminates the TCP connection with the requesting browser.

Once it became clear that web application developers needed session to solve certain problems, Netscape added cookies to their server, and other webserver's have followed suit.

Without cookies, the only way to create any semblance of session is via a url parameter that the application adds to each link identifying the user. This is not a great way to provide session, because it's not unusual for people to bookmark links, or to paste them into forms etc., and this opens the door for crackers to step into the middle of someone else's session, purely by clicking on a link that inadvertantly was leaked, and which contains another user's session id parameter.

For this reason, the suggested way to utilize PHP's included session functions is to allow it to set the session id in a cookie.

The problems with cookies is very much over stated. In the distant past there were some bugs in browser handling of cookies, but those bugs have been fixed long ago. The main issue now is that some people may turn cookies off, and if your application relies on them, then it may not work.

In summary, the answer to your question is really inherent in a good understanding of how cookies work. A server may request that the browser accept a cookie. If it does, the value of that cookie is sent in every request the browser makes to the server that set the cookie, from then on, or until the cookie expires. Since there is no other way to store a value on a users computer, cookies are really the only game in town, as far as basic browsers and html are concerned.

2006-06-23 17:07:03 · answer #1 · answered by Gizmo L 4 · 0 0

Disadvantages Of Php

2016-10-15 07:01:04 · answer #2 · answered by Anonymous · 0 0

Advantages : Easy cross session persistence, relatively inexpensive, most people have them enabled... but

Dissadvantages : .... Cookies aren't ALWAYS enabled in all browsers. So if your code expects cookies set in certain cases you'll see odd behavior because they won't exist.

2006-06-23 16:55:44 · answer #3 · answered by MC Nat 2 · 0 0

Cookie and Session ,both of them are hackable , it's better to don't use them , not need to designing, go and sleep

2006-06-23 20:52:02 · answer #4 · answered by Spitrabergâ?¢ 4 · 0 0

+
persistence and client-side data storage

-
cannot be used on PCs with cookes disabled or mobile devices (cell phones, etc.)

2006-06-23 18:29:48 · answer #5 · answered by _anonymous_ 4 · 0 0

fedest.com, questions and answers