Skip to content
WJunction - Webmaster Forum

cookie check code please help

Status
Not open for further replies.
hi

i found a code of cookies checking enabled or not ,but it is only for main page not for posts can u please help me , so that it also work for single posts thanx

here is code

Code:
<?php
 
function cookies_enabled()
{
        $cookie_sent = setcookie('tc','ok',time()+3600);
        if($cookie_sent == false){die('Test cookie not sent');}
        
        $redirected = (isset($_GET['cs']) && $_GET['cs'] == '1' ? $_GET['cs'] : '0');
        
        if($redirected == '0')
        {
                header('Location: '.$_SERVER['PHP_SELF'].'?cs=1');return;//or should I put exit() ?
        }
        
        return (isset($_COOKIE['tc']) && strcmp($_COOKIE['tc'],'ok') === 0);
}
 
 
if(cookies_enabled())echo 'Cookies ON';
else echo 'Cookies OFF';
 
?>
 
Status
Not open for further replies.

About the author

pioneer_fawad
Banned · Joined
know me know life No me No Life Posting Warez nothing else
687
Messages
62
Reactions
28
Points
Grow your business

Advertise on WJunction

Connect with an established international community of webmasters, hosting providers, developers and online entrepreneurs.

  • Premium & Premium+ Sticky
  • Dedicated section banners
  • Site-wide banner advertising
Explore advertising options
Back
Top Bottom