他的第二步应该是:
在memcp.php最后的“}”的上面加如下代码
- } elseif($action == 'changename') {
- $change_credit = 500; // 改名要花的积分
- $change_creditid = 'extcredits7'; // 扣除的积分所在的序列
- $change_annuct = 1; // 是否发布改名通知
-
- if(!submitcheck('changesubmit', 1)) {
- $credit_num = $db->fetch_array($db->query("SELECT {$change_creditid} FROM {$tablepre}members WHERE uid='{$discuz_uid}'"));
- if($credit_num[$change_creditid] < $change_credit) {
- showmessage('您的积分不足够支付改名所需的费用。');
- } else {
- include template('memcp_changename');
- }
- } else {
- $guestexp = '\xA1\xA1|\xAC\xA3|^Guest|^\xD3\xCE\xBF\xCD|\xB9\x43\xAB\xC8';
- $censorexp = '/^('.str_replace(array('\\*', "\r\n", ' '), array('.*', '|', ''), preg_quote(($censoruser = trim($censoruser)), '/')).')$/i';
- if(preg_match("/^\s*$|^c:\\con\\con$|[%,\*"\s\t\<\>\&]|$guestexp/is", $username) || ($censoruser && @preg_match($censorexp, $username))) {
- showmessage('您输入的用户名无效,请返回重新输入。');
- }
- if($username == $discuz_user) showmessage('您到底是要改名还是玩哪?');
- if(trim($because) == '') showmessage('请没有输入更名原因,请返回修改。');
- $chk = $db->fetch_array($db->query("SELECT uid FROM {$tablepre}members WHERE username='". addslashes($username) . "'"));
- if($chk) showmessage('您输别人的用户名干啥?赶快返回换个别的。');
- $db->query("UPDATE {$tablepre}members SET username='" . addslashes($username) . "', {$change_creditid}={$change_creditid}-{$change_credit} WHERE uid='$discuz_uid'");
- if($change_annuct) {
- $db->query("INSERT INTO {$tablepre}announcements VALUES(0, '$discuz_user', '会员「{$discuz_user}」改名通知', '0', '$timestamp', '0', '" . date('Y年m月d日 H:i') . " - 会员: [color=blue]{$discuz_user}[/color] 更名为: [color=red]{$username}[/color]" . "\n\n" . "更名原因: [color=purple]" . addslashes($because) . "[/color]" . "\n\n" . "会员 [color=red]{$username}[/color] - 改名手续费: [color=blue]积分 {$change_credit} 点[/color] 。如有问题,请PM管理员。')");
- }
- showmessage('恭喜您,改名成功!', 'index.php');
- }
复制代码
[ 本帖最后由 yvips809 于 2006-1-17 23:52 编辑 ] |