Jump to content

Recommended Posts

Hi, I was just wondering what impact there would be in terms of performance if you where to set then increment the value of a cookie on each page of a site.   

 

Also, being a server side script; how exactly does php retrieve the value of a cookie? 

 

Does the server need to request then wait for the appropriate cookie before displaying any content? 

 

Wouldn't this be slower than querying a database?

Link to comment
https://forums.phpfreaks.com/topic/177855-solved-performance-impact-of-cookies/
Share on other sites

The cookie holds data on the client, and that data is included in the header of each request. If the script that the client requests can use the data in the cookie it will.

 

Session cookies work differently. The data of a session cookie is actually held on the server, and the client receives a special cookie that has a unique value, sort of like a key, that allows the data on the server to be used.

 

I don't believe there is a performance impact for simple cookie usage.

If you are going to do that, why don't you just do it by i.p. instead of cookie? Some wise guy might set there page count in their cookie to "53094839045" or even text.

 

Once the cookie's value reaches a certain number, it's reset to 0 and the user is redirected to another page.  They'd have no reason to do that :P

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.