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

 找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索

[经验] UChome2.0用户注册增加 性别,生日,地点等信息

[复制链接]
gatgatguo 发表于 2009-10-17 02:41:47 | 显示全部楼层 |阅读模式
UCHome插件
语言编码:  
插件名称: UChome2.0用户注册增加 性别,生日,地点,QQ等信息
插件作者: www.looguo.cn
适用版本: UCHome 2.0
本帖最后由 gatgatguo 于 2009-10-17 13:34 编辑

有图有真相,有兴趣去测试下可用性,需要的站内联系;



修改方法:注意是UCHOME2.0的,可根据站点需求增加删除不需要的条目

就改2个文件,

source/do_register.php 和 default/do_register.htm

打开source/do_register.php,做2步修改
第1步)
找到
//开通空间
   include_once(S_ROOT.'./source/function_space.php');
   $space = space_open($newuid, $username, 0, $email);

在其下面加上
//常去出差地、常住地和性别,生日 QQ 需要哪个就保留哪个
$jiasetarr = array(
'uid' => $newuid,
'sex' => $_POST['sex'],
'qq' => $_POST['qq'],
'birthprovince' => $_POST['birthprovince'],
'birthcity' => $_POST['birthcity'],
'resideprovince' => $_POST['resideprovince'],
'residecity' => $_POST['residecity']);
updatetable('spacefield', $jiasetarr, array('uid'=>$newuid));


第2步)找到
$invitepay = getreward('invitecode', 0);
$pay = $app ? 0 : $invitepay['credit'];

在下面加上,主要用来为日期赋值
//生日:年
        $birthyeayhtml = '';
        $nowy = sgmdate('Y');
        for ($i=0; $i<100; $i++) {
                $they = $nowy - $i;
                $selectstr = $they == $space['birthyear']?' selected':'';
                $birthyeayhtml .= "<option value=\"$they\"$selectstr>$they</option>";
        }
        //生日:月
        $birthmonthhtml = '';
        for ($i=1; $i<13; $i++) {
                $selectstr = $i == $space['birthmonth']?' selected':'';
                $birthmonthhtml .= "<option value=\"$i\"$selectstr>$i</option>";
        }
        //生日:日
        $birthdayhtml = '';
        for ($i=1; $i<32; $i++) {
                $selectstr = $i == $space['birthday']?' selected':'';
                $birthdayhtml .= "<option value=\"$i\"$selectstr>$i</option>";
        }


打开default/do_register.htm,做1步修改
找到
<tr><th>邮箱</th><td><input type="text" id="email" name="email" value="@" class="t_input" tabindex="5" />
  <br>请准确填入您的邮箱,在忘记密码,或者您使用邮件通知功能时,会发送邮件到该邮箱。</td></tr>

在其下面加入
<tr><th>性别</th>
  <td><label for="sexm">
  <input id="sexm" type="radio" value="1" name="sex" checked>男</label>
  <label for="sexw"><input id="sexw" type="radio" value="2" name="sex">女</label>
  <span style="font-weight:bold;color:red;">(性别选择确定后,将不能再次修改)</span></td>
</tr>
<tr><th>常住地</th>
  <td id="birthcitybox"><script type="text/javascript" src="source/script_city.js"></script>
  <script type="text/javascript">
  <!--
showprovince('birthprovince', 'birthcity', '$space[birthprovince]', 'birthcitybox');
                showcity('birthcity', '$space[birthcity]', 'birthprovince', 'birthcitybox');
  
  //-->
  </script></td>
</tr>
<tr><th>常去出差地</th>
  <td id="residecitybox"><script type="text/javascript">  
  <!--
   showprovince('resideprovince', 'residecity', '$space[resideprovince]', 'residecitybox');
showcity('residecity', '$space[residecity]', 'resideprovince', 'residecitybox');
  //-->
  </script></td>
</tr>
<tr><th>生日</th>
  <td><select id="birthyear" name="birthyear" onchange="showbirthday();">
                        <option value="0">&nbsp;</option>
                        $birthyeayhtml
                </select> 年
                <select id="birthmonth" name="birthmonth" onchange="showbirthday();">
                        <option value="0">&nbsp;</option>
                        $birthmonthhtml
                </select> 月
                <select id="birthday" name="birthday">
                        <option value="0">&nbsp;</option>
                        $birthdayhtml
                </select> 日
  </td>
</tr>

<tr><th>QQ</th><td>
   <input type="text" class="t_input" name="qq" value="$space[qq]" />
                </td></tr>

提醒:地址选择,注意这里和1.5的不同<td id="residecitybox"><script type="text/javascript">  
  <!--
   showprovince('resideprovince', 'residecity', '$space[resideprovince]', 'residecitybox');
showcity('residecity', '$space[residecity]', 'resideprovince', 'residecitybox');
  //-->
  </script></td>


以下加不加都可,判断用的
再在<head></head>之间加入
<script type="text/javascript">
function validate(obj) {
    var subject = $('birthprovince'); //判断城区是否合法
    if (subject) {
     var slen = strlen(subject.value);
        if (slen == 0) {
            alert("请选择您所在家乡的城区");
            subject.focus();
            return false;
        }
    }
    var subject = $('birthcity'); //判断乡镇是否合法
    if (subject) {
     var slen = strlen(subject.value);
        if (slen == 0) {
            alert("请选择您所在家乡的乡镇");
            subject.focus();
            return false;
        }
    }
    var subject = $('resideprovince'); //判断城区是否合法
    if (subject) {
     var slen = strlen(subject.value);
        if (slen == 0) {
            alert("请选择您所在居住的城区");
            subject.focus();
            return false;
        }
    }
    var subject = $('residecity'); //判断乡镇是否合法
    if (subject) {
     var slen = strlen(subject.value);
        if (slen == 0) {
            alert("请选择您所在居住的乡镇");
            subject.focus();
            return false;
        }
    }
    }
</script>

再把<form id="registerform" name="registerform" action="do.php?ac=$_SCONFIG[register_action]&$url_plus&ref" method="post" class="c_form">
修改成<form id="registerform" name="registerform" action="do.php?ac=$_SCONFIG[register_action]&$url_plus&ref" method="post" class="c_form" onsubmit="return  validate(this);">

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?立即注册

x
ttfok 发表于 2009-10-17 10:43:26 | 显示全部楼层
ttfok@qq.com
给一份!!!谢过了,IP以送上
回复

使用道具 举报

mgqhjw9998 发表于 2009-10-17 11:10:28 | 显示全部楼层
673124757@qq.com

本人也想要一份!!谢谢
回复

使用道具 举报

blackbee 发表于 2009-10-17 11:11:15 | 显示全部楼层
注册信息输入太多,人家都不要注册了
回复

使用道具 举报

chem59 发表于 2009-10-17 12:23:27 | 显示全部楼层
很需要  我的信箱 ytopcom@126.com
回复

使用道具 举报

hechangju 发表于 2009-10-17 12:37:12 | 显示全部楼层
送我一个吧!327281818@qq.com
回复

使用道具 举报

 楼主| gatgatguo 发表于 2009-10-17 13:10:46 | 显示全部楼层
就改2个文件,

source/do_register.php 和 default/do_register.htm

编辑楼主贴吧,方便点
回复

使用道具 举报

chem59 发表于 2009-10-17 13:19:47 | 显示全部楼层
那就请发布修改教程吧!很是期待!
回复

使用道具 举报

丫酷 发表于 2009-10-17 13:21:30 | 显示全部楼层

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?立即注册

x
回复

使用道具 举报

 楼主| gatgatguo 发表于 2009-10-17 13:35:41 | 显示全部楼层
马上去赶飞机,辛苦整理,自己顶下
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2024-5-18 05:33 , Processed in 0.106419 second(s), 19 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2023, Tencent Cloud.

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