| | |
Is session will work if cookies are disbaled on clinet side?
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
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!
Brainyminds | Merchant Account Services | I Love Code
IT'S HERE: Merchant Accounts 101 Everything you need to know about merchant accounts!
1) Set a cookie
2) Check for that cookie. If you don't see it, then they don't accept cookies.
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!
Brainyminds | Merchant Account Services | I Love Code
IT'S HERE: Merchant Accounts 101 Everything you need to know about merchant accounts!
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!
Brainyminds | Merchant Account Services | I Love Code
IT'S HERE: Merchant Accounts 101 Everything you need to know about merchant accounts!
•
•
Join Date: Jun 2007
Posts: 8
Reputation:
Solved Threads: 0
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
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
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!
Brainyminds | Merchant Account Services | I Love Code
IT'S HERE: Merchant Accounts 101 Everything you need to know about merchant accounts!
•
•
•
•
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.
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
•
•
Join Date: Jun 2007
Posts: 8
Reputation:
Solved Threads: 0
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
Ric
![]() |
Other Threads in the PHP Forum
- Previous Thread: image verification problem
- Next Thread: PHP / IIS / Integrated login w/ home directories
Views: 4080 | Replies: 18
| Thread Tools | Search this Thread |
Tag cloud for PHP
.htaccess access ajax apache api array beginner binary broken cakephp checkbox class cms code cron curl database date directory display download dynamic ebooks echo email error file files folder form forms function functions google href htaccess html image include insert integration ip java javascript joomla jquery js limit link login loop mail mediawiki menu methods mlm mod_rewrite multiple mysql oop parse paypal pdf php problem query radio random recursion regex remote script search select server sessions sms soap source space speed sql stored structure subdomain syntax system table tutorial update updates upload url validation validator variable video web xml youtube






