简体   繁体   中英

Check if cookie exists on website

I'm trying to redirect my users of my website toa page if a certain session cookie exists. The session cookie is from another website and called pubcookie_l. How do I see if this cookie exists when on my website, perhaps checking in php? Thanks.

This is not possible. You can not check some other domains cookie on different domain.

However you can check the Referer . If the referer is your university's website.

In PHP Referer can be accessed by $_SERVER['HTTP_REFERER'] variable.

Cookies don't exist "on the website", they exist on the client. And the client doesn't (shouldn't) give any cookies to a domain that didn't set it.

If it did, that would be a huge security risk (cookies often contain passwords or other sensitive information, even though they shouldn't), not to mention privacy concerns.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM