Discuz!官方免费开源建站系统

 找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索

[已经确认] 个人资料出生日期这个绝对有问题!

[复制链接]
antol 发表于 2009-2-23 11:24:16 | 显示全部楼层 |阅读模式
本帖最后由 茄子 于 2009-2-25 09:56 编辑

2月居然有30和31日
所有的小月都可选31日

这个问题昨天反映后版主给打上了“不是问题”,这个怎么不是问题?

官方的程序都有这个问题,下面的链接是我在UCH官方站上的个人主页,你们看看我的个人资料!生日我可以是2月31日,这个还不是问题?
http://u.discuz.net/home/space-435285.html
fantom 发表于 2009-2-23 16:24:45 | 显示全部楼层
本帖最后由 fantom 于 2009-2-23 16:49 编辑

第一步:
       修改程序
       打开cp.profile.php
          //生日:年
  1. $birthyeayhtml = '';
  2. $nowy = sgmdate('Y');
  3. for ($i=0; $i<100; $i++) {
  4.         $they = $nowy - $i;
  5.         $selectstr = $they == $space['birthyear']?' selected':'';
  6.         $birthyeayhtml .= "<option value="$they"$selectstr>$they</option>";
  7. }
  8. //生日:月
  9. $birthmonthhtml = '';
  10. for ($i=1; $i<13; $i++) {
  11.         $selectstr = $i == $space['birthmonth']?' selected':'';
  12.         $birthmonthhtml .= "<option value="$i"$selectstr>$i</option>";
  13. }
  14. //生日:日
  15. $birthdayhtml = '';
  16. for ($i=1; $i<32; $i++) {
  17.         $selectstr = $i == $space['birthday']?' selected':'';
  18.         $birthdayhtml .= "<option value="$i"$selectstr>$i</option>";
  19. }
复制代码
注释掉


第二步:
            修改模板
        打开cp_profile.htm
       (1)
  1.    <select id="birthyear" name="birthyear">
  2.                         <option value="0">无</option>
  3.                         $birthyeayhtml
  4.                 </select> 年
  5.                 <select id="birthmonth" name="birthmonth">
  6.                         <option value="0">无</option>
  7.                         $birthmonthhtml
  8.                 </select> 月
  9.                 <select id="birthday" name="birthday">
  10.                         <option value="0">无</option>
  11.                         $birthdayhtml
  12.                 </select> 日
复制代码
改成
  1.                 <select name=birthyear size=1 onchange="showbirthmonth();showbirthday()">
  2. <script>
  3. var birthyearbegin=1900,birthyearend=2005;
  4. <!--{if $space[birthyear]}-->
  5. document.write("<option value=$space[birthyear] selected>$space[birthyear]</option>")
  6. <!--{else}-->
  7. document.write("<option value=''selected>年份</option>")
  8. <!--{/if}-->
  9. for(var i=birthyearbegin;i<=birthyearend;i++){
  10. document.write ("<option value="+i+">"+i+"</option>")
  11. }
  12. </script>
  13. </select>  年
  14.                 <select id="birthmonth" name="birthmonth" onchange="showbirthday();">
  15.                         <!--{if $space['birthmonth']}-->
  16.                         <option value="$space[birthmonth]" selected>$space[birthmonth]</option>
  17.                         <!--{else}-->
  18.                                 <option value="">月份</option>
  19.                         <!--{/if}-->
  20.                 </select> 月
  21.                 <select id="birthday" name="birthday">
  22.                      <!--{if $space[birthday]}-->
  23.                          <option value="$space[birthday]" selected>$space[birthday]</option>
  24.                          <!--{else}-->
  25.                          <option value=''>日期</option>
  26.                          <!--{/if}-->
  27.                 </select>日
复制代码
(2)
  1.   <form method="post" action="cp.php?ac=profile&ref" class="c_form" >
复制代码
改成
  1. <form method="post" action="cp.php?ac=profile&ref" class="c_form" name="f1">     
复制代码
(3)
  1. <script>
  2. var elbirthyear=eval(document.f1.birthyear)
  3. var elbirthmonth=eval(document.f1.birthmonth);
  4. function showbirthmonth(){
  5. if(elbirthyear.value!=""){
  6. for(var i=0;i<12;i++){
  7. elbirthmonth.options.add(new Option(i+1, i+1));
  8. }
  9. }
  10. }

  11. function showbirthday(){
  12. var elbirthday=eval(document.f1.birthday);
  13. if(elbirthmonth.value!="" && elbirthyear.value!=""){
  14. elbirthday.length=0;
  15. for(var i=0;i<28;i++){
  16. elbirthday.options.add(new Option(i+1, i+1));
  17. }
  18. if(elbirthmonth.value!="2"){
  19. elbirthday.options.add(new Option(29, 29));
  20. elbirthday.options.add(new Option(30, 30));
  21. }
  22. switch(elbirthmonth.value){
  23. case "1":
  24. case "3":
  25. case "5":
  26. case "7":
  27. case "8":
  28. case "10":
  29. case "12":{
  30. elbirthday.options.add(new Option(31, 31));
  31. }
  32. case "2":{
  33. var nbirthyear=elbirthyear.value;
  34. if(nbirthyear%400==0 || nbirthyear%4==0 && nbirthyear%100!=0)elbirthday.options.add(new Option(29, 29));
  35. }

  36. }
  37. }
  38. }
  39. </script>   
复制代码
还有个问题就是重新选择时
已选择的无法取消(有重复选项但不影响结果)
本人太差只能做到这种程度
回复

使用道具 举报

茄子 发表于 2009-2-25 09:56:20 | 显示全部楼层
之后修正下
回复

使用道具 举报

ylmotol7 发表于 2009-4-12 13:49:21 | 显示全部楼层
我的是好的啊
你操作不对吧
回复

使用道具 举报

hudielan 发表于 2009-4-12 21:37:32 | 显示全部楼层
这个BUG已经反馈上去了。
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

手机版|小黑屋|Discuz! 官方站 ( 皖ICP备16010102号 )star

GMT+8, 2024-6-10 12:45 , Processed in 0.098660 second(s), 16 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2023, Tencent Cloud.

快速回复 返回顶部 返回列表