WeberDev.com PHP and MySQL Code

LOG IN
BEGINNER GUIDES  |  PHP CLASSES  |  CODE SEARCH  |  ARTICLES SEARCH  |  PHP FORUMS  |  PHP MANUAL  |  PHP FUNCTIONS LIST  |  WEB SITE TEMPLATES
Start typing to search for PHP and MySQL Code Snippets and Articles Search
Submit a code Example / Snippet Submit Your Code
Search Engine Optimization Monitor SEO Monitor
Web Site UpTime Monitor UpTime Monitor
WeberDev's Monthly code contest PHP Code Contest
Your Personal Examples List My Favorite Examples
Your Personal Articles List My Favorite Articles
Edit Account Info Update Your Profile
PHP Code Search
Web Development Forums
Learn MySQL Playing Trivia
PHPBB2 Templates
Web Development Index
PHP Web Logs (BLogs)
Web Development Resources
Web Development Content
PHPClasses
PHP Editor
PHP Jobs
Vision.To Design
Ajax Tutorials
PHP Programming Help
PHP/MySQL Programming
Webmaster Resources
Webmaster Forum
XML meta language
website builder
Submit Site
Forex Trading Online forex trading platform

Go Back Add a Comment Send this example to a friend Add this Article to your personal favoritest for easy future access to your favorite Code Examples and Articles. Submit a code example Print this code example.
BACK ADD A COMMENT SEND TO A FRIEND ADD TO MY FAVORITES ADD CODE EXAMPLES PRINT
Title : Cookies, PHP and y2k compliance (y2k_compliance).
Categories : PHP, Cookies
Boaz Yahav
Date : Jan 17th 2000
Grade : 2 of 5 (graded 5 times)
Viewed : 6572
File : No file for this code example.
Images : No Images for this code example.
Search : More code by Boaz Yahav
Action : Grade This Code Example
Tools : My Examples List

  Submit your own code examples 
 

Some users told me that they could not log into the system. They said they kept getting the
login window again and again without any error message. At first I was sure they were simply
not allowing cookies but than came Manuel Lemos and taught me something new about
cookies and Y2K.

It seems that different browsers see the expiration date in the cookie differently.
This "problem" applies to any server side language, says Zeev Suraski, because it's a client-
side problem. Navigator 3.x doesn't understand 4 digit years. On the other hand, it properly
understands 00 through 69 as 2000 through 2069, so it works ok even today with 2 digit
years. The problem is that some browsers today no longer understand 2 digit years, so you
can't really win - if you use 4 digit years Navigator 3.x wont work, and if you use 2 digit years
some other browsers wont work.

There are two ways to overcome this:

1. Set your y2k_compliance in your php.ini to "on" and then older browsers might have a
problem with the 4 digits (NC 3.x will probably not work) but hey, it's time to upgrade
Statistics on WeberDev shows the percentage of NC 3.x users on 0.43% so I guess, for the
best of everyone those 0.43% upgrade their browsers.

2. The second solution offered by Manuel Lemos was to fallback to not set the cookie expiry
date (volatile cookies).

In any case, I thought this was important enough to make an example of.

Berber



PHP4 MYSQL Authentication Script with cookie. Short & Sweet
Categories : Authentication, Apache, Cookies, PHP, MySQL
A very simple PHP single password cookie based login without usernames.
Categories : PHP, Cookies, Security, Beginner Guides
Authentication script to authenticate users in Active Directory through LDAP.
Categories : LDAP, Authentication, Cookies, PHP
cookie
Categories : Cookies, PHP
Example voting script. Lets people enter suggestions and vote for existing ones.
Categories : MySQL, PHP, Cookies, Complete Programs, Databases
Function that allows a Javascript cookie to be set after HTML has been outputted to the page.
Categories : PHP, Java Script, Cookies, HTML and PHP
The Best Authorize
Categories : PHP, MySQL, Cookies
Secure Login
Categories : PHP, MySQL, Cookies, Security
Simple Cookie example
Categories : PHP, Beginner Guides, Cookies
With this class you can use cookies with chips
Categories : PHP, Cookies
Query2Report : Generating Html, Pdf and Csv Reports from SQL Query
Categories : PHP, PHP, HTML, PDF, Excel
How to make sure a that $foo is from a cookie and not from the URI.
Categories : PHP, Variables, Global Variables, Cookies
Function that does language negotiation based on the Accept-Language header, a cookie or host name
Categories : HTTP, PHP, Cookies
Cross Browser Session Starter
Categories : PHP, Sessions, Cookies
Store, retrieve and delete cookies using JavaScript.
Categories : Java Script, Cookies, Beginner Guides, Cookies