Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • How to check if cookie is enable or not

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 328
    Comment on it

    Hi. If you are looking for code to alert user if his cookies are enable or not, Then look the code as below:-

    paste the code in you file

    <?php
    
    if (isset($_COOKIE['cookieCheck'])) {
        echo 'Your cookie is Enable';
    } else {
        if (isset($_GET['reload'])) {
            echo 'Sorry your cookie is not Enable';
        } else {
            setcookie('cookieCheck', '1', time() + 60);
            header('Location: ' . $_SERVER['PHP_SELF'] . '?reload');
            exit();
        }
    }
    ?>
    

    Output:-

    Sorry your cookie is not Enable
    

    See the image example below:
    Code:

    alt text


    Output:

    alt text

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: