开发者

How to set a php session cookie to all websites?

开发者 https://www.devze.com 2023-01-15 05:26 出处:网络
i\'m making a adwords-like to my clients websites only, and i wan\'t to put the cookies to save the information to all domains (and not just domain mydomain.com or subdomains .mydomain.com, i mean all

i'm making a adwords-like to my clients websites only, and i wan't to put the cookies to save the information to all domains (and not just domain mydomain.com or subdomains .mydomain.com, i mean all).

Code Sample:

setcookie('var_name', 'var_value', null, "/", '.mydomain.com' );

Can anybody h开发者_C百科elp me?

Thanks


You cannot set a cookie for a foreign domain. That would be a serious security flaw. Just think of how easy attacks like session fixation would be.


You can use an iframe to share and display the same information for a specific user on many pages. That's how Google Adsense and many other advertising solution work.


Most tracking systems of this type work by embedding an image or some other object into participating sites which is served from your domain. At this point you can issue cookies from the single domain that you do control, and track the users by watching the referral data on your web requests.

Since the object is served from your domain, there's no need for the cross-domain cookies that you're asking for, which is fortunate because they're not possible to do.

0

精彩评论

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

关注公众号