Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!

setcookie is not working in cpanel

Discussion in 'General Discussion' started by hedonistdahal, Sep 12, 2012.

  1. hedonistdahal

    hedonistdahal Registered

    Joined:
    Sep 12, 2012
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Website Owner
    Hello,

    I have used setcookie in php to check users visiting my site. The thing is when i test it in my local server it works, the cookie gets set but when i upload the page in cpanel the cookie doesn't get set.
    Below is a synopsis of my code:

    <?php
    session_start();
    //set the cookie time to desired value;
    setcookie("user", "abc", time()+3600);
    //some other codes

    if(!isset($_COOKIE["user"]))
    {
    //some other codes
    }
    ?>

    Any help will be much appreciated. Thanks :)
     
  2. Infopro

    Infopro cPanel Sr. Product Evangelist
    Staff Member

    Joined:
    May 20, 2003
    Messages:
    16,513
    Likes Received:
    425
    Trophy Points:
    583
    Location:
    Pennsylvania
    cPanel Access Level:
    Root Administrator
    Twitter:
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
Loading...

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice