tags:

views:

28

answers:

3

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?

+2  A: 

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

shamittomar
A: 

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();

Cups
+1  A: 

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.

Frxstrem
oh, sorry if I misinterpreted the question... :S
Frxstrem
I'm using sessions aswell, basically, I'm using url tokens to identify users along with sessions, but I want their values to change everything the user clicks on a link.
john mossel