开发者

Generate a New Cookie for Each Request?

How can you generate a new cookie value, with each new request (e.g. the cookie value changes when you click on a hyperlink).

An example would be something that PEAR AUTH does:

"Each client request 开发者_运维百科a special unique cookie is given to the client. He must present this cookie on his next request. This cookie changes on every request. If client does not present the valid cookie he will be logged out."

Basically how could that ^ be done?


You can use setcookie function in your PHP code to set a new cookie on every page, if you wish.


I think what you're looking for are sessions, which are persistent variables for a user who is identified using a single cookie. The variables are stored on the server, though.

You can set the value of the session cookie using session_id() too.


IF you mean append a count value to a cookie, and the links are links to other sites then you could use Javascript to achieve this.

kinda:

<a onclick = addToCookieAndRelocate();

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜