getVar('dirname')."/include/function.php"; function edit_anniversaire() { global $xoopsUser, $xoopsDB, $xoopsModule; $sql = "SELECT * FROM ".$xoopsDB->prefix("users_aniversario")." WHERE uid='".$xoopsUser->getVar('uid')."'"; $result = $xoopsDB->query($sql); $nb=$xoopsDB->getRowsNum($result); if ($nb=='0') { $jour="1"; $mois="1"; $annee="1930"; } else { while ($en = $xoopsDB->fetchArray($result)) { $jour=$en['jour']; $mois=$en['mois']; $annee=$en['annee']; } } echo "

"._MI_BD_TITRE_2."

 

Perfil  »» "._MI_BD_EDITER."

 

"._MI_BD_ENTRER." :
 
"._MI_BD_VOTRE_DATE." : " .listejour("jour",$jour)." / " .listemois("mois",$mois)." / " .listeannee("annee",(date("Y",time())-10),$annee)."
 

 

"; } function save_anniversaire() { global $xoopsUser, $xoopsDB, $xoopsModule; $myts =& MyTextSanitizer::getInstance(); $jour=$myts->htmlSpecialChars($_POST['jour']); $mois=$myts->htmlSpecialChars($_POST['mois']); $annee=$myts->htmlSpecialChars($_POST['annee']); $uid=$myts->htmlSpecialChars($_POST['uid']); if ($xoopsUser) { $sql = "SELECT * FROM ".$xoopsDB->prefix("users_aniversario")." WHERE uid='$uid'"; $result = $xoopsDB->query($sql); $nb=$xoopsDB->getRowsNum($result); if ($nb==0) { $sql="INSERT ".$xoopsDB->prefix("users_aniversario")." (uid,jour,mois,annee) VALUES ('$uid','$jour','$mois','$annee')"; $result = $xoopsDB->query($sql); if ($result) redirect_header(XOOPS_URL."/",3,_MI_BD_DBUPDATED); else redirect_header(XOOPS_URL."/",3,_MI_BD_NOBIRTHDAYSAVED); } else { $sql="UPDATE ".$xoopsDB->prefix("users_aniversario")." SET jour='$jour',mois='$mois',annee='$annee' WHERE uid='$uid'"; $result = $xoopsDB->query($sql); if ($result) redirect_header(XOOPS_URL."/",3,_MI_BD_DBUPDATED); else redirect_header(XOOPS_URL."/",3,_MI_BD_NOBIRTHDAYSAVED); } } else { redirect_header(XOOPS_URL."/",3,_MI_BD_NO_ACCES); } } if(!isset($_POST['op'])) { $op = isset($_GET['op']) ? $_GET['op'] : 'edit_anniversaire'; } else { $op = $_POST['op']; } switch($op) { case "edit_anniversaire": edit_anniversaire(); break; case "save_anniversaire" : save_anniversaire(); break; } } include "footer.php"; ?>