The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

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:
    14,482
    Likes Received:
    203
    Trophy Points:
    63
    Location:
    Pennsylvania
    cPanel Access Level:
    Root Administrator
    Twitter:
Loading...

Share This Page