Перейти к публикации

Birthday


Рекомендованные сообщения

$year = $db->safesql($_REQUEST['year']);

$month = $db->safesql($_REQUEST['month]);

$day = $db->safesql($_REQUEST['day']);

$date = "{$year}-{$month}-{$day}";

$birthday = trim($date) ? strtotime($date) : "";

is this code is safe to use? i have it in registration.php :rolleyes:

Ссылка на сообщение
Поделиться на других сайтах

yes, but you can also use this construction

$date = $_REQUEST['year']."-".$_REQUEST['month]."-".$_REQUEST['day'];

$birthday = strtotime($date);

if ($birthday === -1) {

//misstake in date

} else {

//if you want to be sure, your can do this:

$birthday = intval($birthday);

//but i think it`s not nessesary

}

_____________________

in some OS this code (neither your) wont be work right, if user`s birthday < 1970

Ссылка на сообщение
Поделиться на других сайтах

Al-x, thanks for information, you are very smart :) and in what kind of OS it will be displayed not right?

ou and how can I make an member age from this? I tried to do something like this: date("today") - the birthday, but it didnt worked :(

Ссылка на сообщение
Поделиться на других сайтах

Архивировано

Эта тема находится в архиве и закрыта для публикации сообщений.

×
×
  • Создать...