|
发表于 2004-6-3 14:49:14
|
显示全部楼层
Re: 请求解释!
[quote:e00c0c727b="nowind"]下面是网上下载的一段原代码,是关于会员注册程序的,请哪位大侠给出详细的注释,含泪感谢!
<?php
require "./include/base.php"; //将base.php文件插入此处
$nav .= SEPARATER."<a href='myshop.php'>".$language['myshop']."</a>";
//给nav赋值 ,包括一个分隔符 链接 语言
$nav .= SEPARATER.$language['personalconfig'];
//同上
if (!$islogin) //如果不是注册用户就将注册模版插入
{
//showmessage('请先登录','./login.php');
include template('login');
exit;
}
if(!$editsubmit) //如果不是新注册
{
$query=$db->query("SELECT * FROM $table_members WHERE uname='$_login_user'"); //从数据库中查询用户
if($dbq_rec = $db->fetch_array($query))
{
$email=$dbq_rec['email'];
$g_m_ischecked=($dbq_rec['gender']==1)?'checked':'';
$g_f_ischecked=($dbq_rec['gender']==2)?'checked':'';
$g_n_ischecked=($dbq_rec['gender']==0)?'checked':'';
$birthday=explode("-",$dbq_rec['birthday']);
$month='';
for($i=1;$i<13;$i++)
{
$isselected=($birthday[1] == $i)?"selected":'';
$month.="<option value='".$i."' ".$isselected.">".$i."</option>";
}
$day='';
for($i=1;$i<32;$i++)
{
$isselected=($birthday[2] == $i)?"selected":'';
$day.="<option value='".$i."' ".$isselected.">".$i."</option>";
}
$oicq=$dbq_rec['oicq'];
$icq=$dbq_rec['icq'];
$msn=$dbq_rec['msn'];
$realname=$dbq_rec['realname'];
$tel=$dbq_rec['tel'];
$mobile=$dbq_rec['mobile'];
$addr=$dbq_rec['addr'];
$postalcode=$dbq_rec['postalcode'];
}
}
else
{
if($password!=$password2) showmessage($language['reg_err_password2']);
if(!checkemail($email)) showmessage($language['reg_err_email']);
if (empty($password))
{
$upd_pass="";
}
else
{
if((strlen($password) < 6) or (strlen($password) > 15))
showmessage($language['reg_errlen_password']);
$password = md5($password);
$upd_pass="password='$password',";
}
$birthday = "$year-$month-$day";
$sqlstr="UPDATE $table_members SET ".$upd_pass.
"email='$email',oicq='$oicq',icq='$icq',msn='$msn',".
"gender='$gender',birthday='$birthday',realname='$realname',".
"tel='$tel',addr='$addr',mobile='$mobile',postalcode='$postalcode'".
" WHERE uname='$_login_user'";
$query=$db->query($sqlstr);
showmessage($language['personal_edit_success'],'personal.php');
}
include template('personal');
?>[/quote]
慢慢写,如果有不对的地方大家一起纠正。 |
|