SchweppesAle Posted October 16, 2009 Share Posted October 16, 2009 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? Quote Link to comment https://forums.phpfreaks.com/topic/177855-solved-performance-impact-of-cookies/ Share on other sites More sharing options...
PugJr Posted October 16, 2009 Share Posted October 16, 2009 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. Quote Link to comment https://forums.phpfreaks.com/topic/177855-solved-performance-impact-of-cookies/#findComment-937794 Share on other sites More sharing options...
sKunKbad Posted October 16, 2009 Share Posted October 16, 2009 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. Quote Link to comment https://forums.phpfreaks.com/topic/177855-solved-performance-impact-of-cookies/#findComment-937796 Share on other sites More sharing options...
SchweppesAle Posted October 16, 2009 Author Share Posted October 16, 2009 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 Quote Link to comment https://forums.phpfreaks.com/topic/177855-solved-performance-impact-of-cookies/#findComment-937797 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.