本帖最后由 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"> </option>
$birthyeayhtml
</select> 年
<select id="birthmonth" name="birthmonth" onchange="showbirthday();">
<option value="0"> </option>
$birthmonthhtml
</select> 月
<select id="birthday" name="birthday">
<option value="0"> </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);"> |