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.
php codeigniter setcookie
|
show 3 more comments
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.
php codeigniter setcookie
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
|
show 3 more comments
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.
php codeigniter setcookie
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
php codeigniter setcookie
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
|
show 3 more comments
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
|
show 3 more comments
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
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
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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