📄 getbirthdaystoprint.php
字号:
<?php
require_once("../inc/constants.inc.php");
require_once("../inc/properties.inc.php");
require_once("../inc/tools.inc.php");
require_once("../inc/db.inc.php");
require_once("../inc/i18n.inc.php");
header('Content-type: text/xml;');
if (!isset($_SESSION['user'])) {
die();
}
$sql = "SELECT P.* FROM `person` P, `user_person` UP " .
" WHERE P.id = UP.idperson AND UP.role != 1 AND P.birthdate != '0000-00-00' AND UP.iduser = '".$_SESSION['user'] . "'" .
" ORDER BY DATE_FORMAT(P.birthdate, '%m/%d'), P.firstname, P.lastname";
$result = mysql_query($sql) or die("Error in SQL : " . $sql);
$dom = new DOMDocument('1.0', ENCODING);
$root = $dom->appendChild(new DOMElement('response'));
$root->setAttribute("sql", $sql);
$oldMonth = $month = "";
$today = getdate();
if ($result && mysql_num_rows($result) > 0) {
while ($line = mysql_fetch_assoc($result)) {
$dateBirth = explode("-", prepShowValue($line['birthdate']));
$birthday = $root->appendChild(new DOMElement('birthday'));
$birthday->setAttribute("id", prepShowValue($line['id']));
$birthday->setAttribute("firstname", prepShowValue($line['firstname']));
$birthday->setAttribute("lastname", prepShowValue($line['lastname']));
$birthday->setAttribute("birthdateDay", prepShowValue($dateBirth[2]));
$birthday->setAttribute("birthdateMonth", prepShowValue($dateBirth[1]));
$birthday->setAttribute("birthdateYear", prepShowValue($dateBirth[0]));
$birthday->setAttribute("age", getAge($line['birthdate']));
$month = $dateBirth[1];
if ($oldMonth != $month) {
$birthday->setAttribute("newMonth", $_MONTH[$month-1]);
}
$oldMonth = $month;
}
}
echo $dom->saveXML();
?>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -