After Browsing another web page the expiration of cookie show N/A in codeigniter









up vote
0
down vote

favorite












I have set the post count in codeigniter by using this code ..



 $this->load->helper('cookie');
$check_visitor = $this->input->cookie(urldecode($vbslug), FALSE);
$ip = $this->input->ip_address();
if($check_visitor == false)

$this->input->set_cookie(urldecode($vbslug),"$ip",3600);
$this->mymodel->increase_views_of_post($vbslug);



In above code the $vbslug is url of my Website post.



There is no problem in setting the cookie, it shows expiration of 1hr and value which is my ip, but the problem is that whenever I browse another post in my website the expiration of that url shows N/A.



See this first image
'kanchan-studio-sh' url having a expiration of 1hr , but when I browse another page.
see this second image
'kanchan-studio-shakarpur' having expiration N/A



I don't what I have done wrong in my code please help me out.










share|improve this question























  • where is the code to echo N/A? further lets say a user browses 10-20 pages... that's 10-20 cookies. you would be better off with a database-based implementation for everything or to simply use google analytics to track the pageview for you pushing the path along with the tracking data. then you can easily retrieve the analytics data. this also allows you more options in terms on analyzing later on.
    – Alex
    18 hours ago










  • Hii.. Alex I have updated my question please check it out
    – utkarsh tiwari
    18 hours ago










  • i guess what i would do is to clear my cookies, everything, and then refresh the page so it sets the cookie then check to see if the cookie still has the valid expiration, and do this a few times just to make sure that other project cookies aren't affecting it. then report back
    – Alex
    18 hours ago











  • No alex it's not working.. I have cleared my cookies, but the issue is again same
    – utkarsh tiwari
    18 hours ago










  • and you checked by only accessing one post right? not trying a few. cuz i just wanted to see if multiple cookies was somehow causing it.
    – Alex
    17 hours ago














up vote
0
down vote

favorite












I have set the post count in codeigniter by using this code ..



 $this->load->helper('cookie');
$check_visitor = $this->input->cookie(urldecode($vbslug), FALSE);
$ip = $this->input->ip_address();
if($check_visitor == false)

$this->input->set_cookie(urldecode($vbslug),"$ip",3600);
$this->mymodel->increase_views_of_post($vbslug);



In above code the $vbslug is url of my Website post.



There is no problem in setting the cookie, it shows expiration of 1hr and value which is my ip, but the problem is that whenever I browse another post in my website the expiration of that url shows N/A.



See this first image
'kanchan-studio-sh' url having a expiration of 1hr , but when I browse another page.
see this second image
'kanchan-studio-shakarpur' having expiration N/A



I don't what I have done wrong in my code please help me out.










share|improve this question























  • where is the code to echo N/A? further lets say a user browses 10-20 pages... that's 10-20 cookies. you would be better off with a database-based implementation for everything or to simply use google analytics to track the pageview for you pushing the path along with the tracking data. then you can easily retrieve the analytics data. this also allows you more options in terms on analyzing later on.
    – Alex
    18 hours ago










  • Hii.. Alex I have updated my question please check it out
    – utkarsh tiwari
    18 hours ago










  • i guess what i would do is to clear my cookies, everything, and then refresh the page so it sets the cookie then check to see if the cookie still has the valid expiration, and do this a few times just to make sure that other project cookies aren't affecting it. then report back
    – Alex
    18 hours ago











  • No alex it's not working.. I have cleared my cookies, but the issue is again same
    – utkarsh tiwari
    18 hours ago










  • and you checked by only accessing one post right? not trying a few. cuz i just wanted to see if multiple cookies was somehow causing it.
    – Alex
    17 hours ago












up vote
0
down vote

favorite









up vote
0
down vote

favorite











I have set the post count in codeigniter by using this code ..



 $this->load->helper('cookie');
$check_visitor = $this->input->cookie(urldecode($vbslug), FALSE);
$ip = $this->input->ip_address();
if($check_visitor == false)

$this->input->set_cookie(urldecode($vbslug),"$ip",3600);
$this->mymodel->increase_views_of_post($vbslug);



In above code the $vbslug is url of my Website post.



There is no problem in setting the cookie, it shows expiration of 1hr and value which is my ip, but the problem is that whenever I browse another post in my website the expiration of that url shows N/A.



See this first image
'kanchan-studio-sh' url having a expiration of 1hr , but when I browse another page.
see this second image
'kanchan-studio-shakarpur' having expiration N/A



I don't what I have done wrong in my code please help me out.










share|improve this question















I have set the post count in codeigniter by using this code ..



 $this->load->helper('cookie');
$check_visitor = $this->input->cookie(urldecode($vbslug), FALSE);
$ip = $this->input->ip_address();
if($check_visitor == false)

$this->input->set_cookie(urldecode($vbslug),"$ip",3600);
$this->mymodel->increase_views_of_post($vbslug);



In above code the $vbslug is url of my Website post.



There is no problem in setting the cookie, it shows expiration of 1hr and value which is my ip, but the problem is that whenever I browse another post in my website the expiration of that url shows N/A.



See this first image
'kanchan-studio-sh' url having a expiration of 1hr , but when I browse another page.
see this second image
'kanchan-studio-shakarpur' having expiration N/A



I don't what I have done wrong in my code please help me out.







php codeigniter setcookie






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited 18 hours ago

























asked 19 hours ago









utkarsh tiwari

76




76











  • where is the code to echo N/A? further lets say a user browses 10-20 pages... that's 10-20 cookies. you would be better off with a database-based implementation for everything or to simply use google analytics to track the pageview for you pushing the path along with the tracking data. then you can easily retrieve the analytics data. this also allows you more options in terms on analyzing later on.
    – Alex
    18 hours ago










  • Hii.. Alex I have updated my question please check it out
    – utkarsh tiwari
    18 hours ago










  • i guess what i would do is to clear my cookies, everything, and then refresh the page so it sets the cookie then check to see if the cookie still has the valid expiration, and do this a few times just to make sure that other project cookies aren't affecting it. then report back
    – Alex
    18 hours ago











  • No alex it's not working.. I have cleared my cookies, but the issue is again same
    – utkarsh tiwari
    18 hours ago










  • and you checked by only accessing one post right? not trying a few. cuz i just wanted to see if multiple cookies was somehow causing it.
    – Alex
    17 hours ago
















  • where is the code to echo N/A? further lets say a user browses 10-20 pages... that's 10-20 cookies. you would be better off with a database-based implementation for everything or to simply use google analytics to track the pageview for you pushing the path along with the tracking data. then you can easily retrieve the analytics data. this also allows you more options in terms on analyzing later on.
    – Alex
    18 hours ago










  • Hii.. Alex I have updated my question please check it out
    – utkarsh tiwari
    18 hours ago










  • i guess what i would do is to clear my cookies, everything, and then refresh the page so it sets the cookie then check to see if the cookie still has the valid expiration, and do this a few times just to make sure that other project cookies aren't affecting it. then report back
    – Alex
    18 hours ago











  • No alex it's not working.. I have cleared my cookies, but the issue is again same
    – utkarsh tiwari
    18 hours ago










  • and you checked by only accessing one post right? not trying a few. cuz i just wanted to see if multiple cookies was somehow causing it.
    – Alex
    17 hours ago















where is the code to echo N/A? further lets say a user browses 10-20 pages... that's 10-20 cookies. you would be better off with a database-based implementation for everything or to simply use google analytics to track the pageview for you pushing the path along with the tracking data. then you can easily retrieve the analytics data. this also allows you more options in terms on analyzing later on.
– Alex
18 hours ago




where is the code to echo N/A? further lets say a user browses 10-20 pages... that's 10-20 cookies. you would be better off with a database-based implementation for everything or to simply use google analytics to track the pageview for you pushing the path along with the tracking data. then you can easily retrieve the analytics data. this also allows you more options in terms on analyzing later on.
– Alex
18 hours ago












Hii.. Alex I have updated my question please check it out
– utkarsh tiwari
18 hours ago




Hii.. Alex I have updated my question please check it out
– utkarsh tiwari
18 hours ago












i guess what i would do is to clear my cookies, everything, and then refresh the page so it sets the cookie then check to see if the cookie still has the valid expiration, and do this a few times just to make sure that other project cookies aren't affecting it. then report back
– Alex
18 hours ago





i guess what i would do is to clear my cookies, everything, and then refresh the page so it sets the cookie then check to see if the cookie still has the valid expiration, and do this a few times just to make sure that other project cookies aren't affecting it. then report back
– Alex
18 hours ago













No alex it's not working.. I have cleared my cookies, but the issue is again same
– utkarsh tiwari
18 hours ago




No alex it's not working.. I have cleared my cookies, but the issue is again same
– utkarsh tiwari
18 hours ago












and you checked by only accessing one post right? not trying a few. cuz i just wanted to see if multiple cookies was somehow causing it.
– Alex
17 hours ago




and you checked by only accessing one post right? not trying a few. cuz i just wanted to see if multiple cookies was somehow causing it.
– Alex
17 hours ago

















active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













 

draft saved


draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53237156%2fafter-browsing-another-web-page-the-expiration-of-cookie-show-n-a-in-codeigniter%23new-answer', 'question_page');

);

Post as a guest



































active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes















 

draft saved


draft discarded















































 


draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53237156%2fafter-browsing-another-web-page-the-expiration-of-cookie-show-n-a-in-codeigniter%23new-answer', 'question_page');

);

Post as a guest














































































這個網誌中的熱門文章

How to read a connectionString WITH PROVIDER in .NET Core?

Node.js Script on GitHub Pages or Amazon S3

Museum of Modern and Contemporary Art of Trento and Rovereto