Is session will work if cookies are disbaled on clinet side?

Reply

Join Date: Feb 2007
Posts: 8
Reputation: mangophp is an unknown quantity at this point 
Solved Threads: 0
mangophp mangophp is offline Offline
Newbie Poster

Is session will work if cookies are disbaled on clinet side?

 
0
  #1
Jul 3rd, 2007
Hi ,

IF Client disabled the cookies..my question is ..

Will session works in PHP..and if yes how it will work ? and if no what other method to maintain the state of the user.

Thnaks in advance,
mangesh.
Last edited by mangophp; Jul 3rd, 2007 at 10:15 am.
Reply With Quote Quick reply to this message  
Join Date: May 2006
Posts: 1,422
Reputation: stymiee is on a distinguished road 
Solved Threads: 35
Moderator
stymiee's Avatar
stymiee stymiee is offline Offline
He's No Good To Me Dead

Re: Is session will work if cookies are disbaled on clinet side?

 
0
  #2
Jul 3rd, 2007
You will need to put the session ID in the URL. You will need to make a change in your php.ini file so if you are on a shared host you will need to contact them to see what they will do for you.
John Conde
Brainyminds | Merchant Account Services | I Love Code
IT'S HERE: Merchant Accounts 101 Everything you need to know about merchant accounts!
Reply With Quote Quick reply to this message  
Join Date: Jun 2007
Posts: 8
Reputation: ric1950 is an unknown quantity at this point 
Solved Threads: 0
ric1950 ric1950 is offline Offline
Newbie Poster

Re: Is session will work if cookies are disbaled on clinet side?

 
0
  #3
Jul 4th, 2007
Can you just tell using PHP if a client browser has their cookies enabled?
I would like to just find out and inform them that they need to enable cookies to use the cart on my site.
Thanks.
Reply With Quote Quick reply to this message  
Join Date: May 2006
Posts: 1,422
Reputation: stymiee is on a distinguished road 
Solved Threads: 35
Moderator
stymiee's Avatar
stymiee stymiee is offline Offline
He's No Good To Me Dead

Re: Is session will work if cookies are disbaled on clinet side?

 
0
  #4
Jul 4th, 2007
1) Set a cookie

2) Check for that cookie. If you don't see it, then they don't accept cookies.
John Conde
Brainyminds | Merchant Account Services | I Love Code
IT'S HERE: Merchant Accounts 101 Everything you need to know about merchant accounts!
Reply With Quote Quick reply to this message  
Join Date: Jun 2007
Posts: 8
Reputation: ric1950 is an unknown quantity at this point 
Solved Threads: 0
ric1950 ric1950 is offline Offline
Newbie Poster

Re: Is session will work if cookies are disbaled on clinet side?

 
0
  #5
Jul 5th, 2007
Thanks John - I thought of doing that but wanted to know if there was another way.
Ric
Reply With Quote Quick reply to this message  
Join Date: May 2006
Posts: 1,422
Reputation: stymiee is on a distinguished road 
Solved Threads: 35
Moderator
stymiee's Avatar
stymiee stymiee is offline Offline
He's No Good To Me Dead

Re: Is session will work if cookies are disbaled on clinet side?

 
0
  #6
Jul 5th, 2007
Unfortunately that's the only reliable way. If you are going to do that be sure to wait until you are actually going to start the session before doing it. That way users with cookies turned off can still surf the site without being bothered with that message. While doing so they may decide it is worth turning cookies on to do what they need to do.
John Conde
Brainyminds | Merchant Account Services | I Love Code
IT'S HERE: Merchant Accounts 101 Everything you need to know about merchant accounts!
Reply With Quote Quick reply to this message  
Join Date: Jun 2007
Posts: 8
Reputation: ric1950 is an unknown quantity at this point 
Solved Threads: 0
ric1950 ric1950 is offline Offline
Newbie Poster

Re: Is session will work if cookies are disbaled on clinet side?

 
0
  #7
Jul 7th, 2007
Thanks for the reply, John

I have a situation that I can't see any way around - I am posting a page to itself and I would like to inform a visitor that the operation of adding items to their cart did not work as they have not enabled cookies on their browser.

However, I can't see a way of distinguishing between a new visitor to the page with cookies disabled and the reload from a visitor with cookies disabled who hit the "add to cart" button.

Do you have any ideas? The only thing I can think of is of going via a second page which can check if the session is carried forward or a cookie is set and then going back to the original 'page' with:
echo "<body onload=setTimeout(\"location.href='page.php'\",0)>";
but when you do that you get a white screen while that is happening in between the reloads.

I don't know if I can give a link in this forum but I have my page on the internet in a Testing folder if you want to have a look to see what I am trying to do.

Thanks

Ric
Reply With Quote Quick reply to this message  
Join Date: May 2006
Posts: 1,422
Reputation: stymiee is on a distinguished road 
Solved Threads: 35
Moderator
stymiee's Avatar
stymiee stymiee is offline Offline
He's No Good To Me Dead

Re: Is session will work if cookies are disbaled on clinet side?

 
1
  #8
Jul 7th, 2007
As soon as they hit your site set a cookie regardless of what page they enter from. Don't check for it right away though. Some people will just want to browse and that's fine. But as soon as they try to use a feature that requires cookies look for the cookie you set. If it isn't there take them to a page that explains why they need to have cookies enabled.
John Conde
Brainyminds | Merchant Account Services | I Love Code
IT'S HERE: Merchant Accounts 101 Everything you need to know about merchant accounts!
Reply With Quote Quick reply to this message  
Join Date: Apr 2007
Posts: 136
Reputation: dr4g is an unknown quantity at this point 
Solved Threads: 5
dr4g's Avatar
dr4g dr4g is offline Offline
Junior Poster

Re: Is session will work if cookies are disbaled on clinet side?

 
0
  #9
Jul 8th, 2007
Originally Posted by stymiee View Post
As soon as they hit your site set a cookie regardless of what page they enter from. Don't check for it right away though. Some people will just want to browse and that's fine. But as soon as they try to use a feature that requires cookies look for the cookie you set. If it isn't there take them to a page that explains why they need to have cookies enabled.
I recommend this method too.
It's simple yet effective, without too much complexity or code to be done.

1) Set a cookie when user visits site.
2) If they try to do something which needs cookies, check if the cookie exists.. if it doesn't they don't have cookies enabled.
Thus take them to the "cookies required" page.

Cheers.

Welldone stymiee, nice logic
GardCMS :: Open Source CMS :: Gardcms.org
Reply With Quote Quick reply to this message  
Join Date: Jun 2007
Posts: 8
Reputation: ric1950 is an unknown quantity at this point 
Solved Threads: 0
ric1950 ric1950 is offline Offline
Newbie Poster

Re: Is session will work if cookies are disbaled on clinet side?

 
0
  #10
Jul 8th, 2007
Thanks for the replies but unless there is some way of intercepting between when the customer hits the submit button ('Add to Cart') and when the page submits to itself there is no way of knowing if the reload is from the submit button or a new visitor. I see other web sites are linked to this forum so if you want to have a look at my site go to http://www.biodistributors.com.au/Te...les/health.php and disable cookies and see what happens when you try to add items to the cart. The idea is that the "view cart' button doesn't show if the cart is empty. What I am developing now is to show the "view cart' button all the time and when a user who has disabled cookies hits it they get the explanation about cookies needing to be set. Before that the page will just reload unchanged.

Ric
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Other Threads in the PHP Forum


Views: 4080 | Replies: 18
Thread Tools Search this Thread



Tag cloud for PHP
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC