http://gamania.idv.tw/
原始文章 :
‧ http://phpbb-tw.net/phpbb/viewtopic.php?p=196722#196722
開發作者 :
‧~倉木麻衣~ & 心靈捕手
代碼: 選擇全部
#
#--------[ OPEN ]----------------
#
includes/usercp_register.php
#
#--------[ FIND ]----------------
#
//
// Check and initialize some variables if needed
//
if (
isset($HTTP_POST_VARS['submit']) ||
#
#--------[ AFTER, ADD ]----------------
#
代碼:
isset($HTTP_POST_VARS['check_username']) ||
#
#--------[ FIND ]----------------
#
代碼:
if ($mode == 'register' && ($userdata['session_logged_in'] || $username == $userdata['username']))
{
message_die(GENERAL_MESSAGE, $lang['Username_taken'], '', __LINE__, __FILE__);
}
#
#--------[ AFTER, ADD ]----------------
#
代碼:
//
//+ Check username
//
if (isset($HTTP_POST_VARS['check_username']))
{
$username = trim(htmlspecialchars($HTTP_POST_VARS['username']));
if (empty($username))
{
$template->assign_block_vars('switch_checkname', array(
'CHECKNAME' => $lang['Username_empty']));
}
}
if ($username && isset($HTTP_POST_VARS['check_username']))
{
$checkname_result = validate_username($username);
$template->assign_block_vars('switch_checkname', array(
'CHECKNAME' => $checkname_result['error'] ? $lang['Username_taken'] : $lang['Username_nottaken']));
}
//
//- Check username
//
#
#--------[ OPEN ]----------------
#
templates/您的風格/profile_add_body.tpl
#
#--------[ FIND ]----------------
#
代碼:
<form action="{S_PROFILE_ACTION}" {S_FORM_ENCTYPE} method="post">
#
#--------[ BEFORE, ADD ]----------------
#
代碼:
<!-- BEGIN switch_checkname -->
<Script Language="Javascript">
window.alert('{switch_checkname.CHECKNAME}');
</Script>
<!-- END switch_checkname -->
#
#--------[ FIND ]----------------
#
代碼:
<td class="row2"><input type="text" class="post" style="width:200px" name="username" size="25" maxlength="25" value="{USERNAME}" /></td>
#
#--------[ REPLACE WITH ]----------------
#
代碼:
<td class="row2"><input type="text" class="post" style="width:200px" name="username" size="25" maxlength="25" value="{USERNAME}" />
<input type="submit" name="check_username" value="檢查帳號" class="liteoption" /></td>
\n#
#--------[ OPEN ]----------------
#
language/lang_chinese_traditional_taiwan/lang_main.php
#
#--------[ FIND ]----------------
#
代碼:
$lang['Username_taken'] = '很抱歉!! 您所選擇的會員名稱已被註冊使用';
#
#--------[ AFTER, ADD ]----------------
#
代碼:
$lang['Username_nottaken'] = '恭喜您!! 您所選擇的會員名稱尚未有人使用';
$lang['Username_empty'] = '您必須輸入會員名稱';
#
#--------[ SAVE/CLOSE ALL FILES ]----------------
#
# EoM
忘了考慮您還有開啟 visual confirmation
試看看再加入底下的程式碼
#
#--------[ OPEN ]----------------
#
includes/usercp_register.php
#
#--------[ FIND ]----------------
#
代碼:
$sql = 'SELECT COUNT(session_id) AS attempts
#
#--------[ BEFORE, ADD ]----------------
#
代碼:
if (isset($HTTP_POST_VARS['check_username']))
{
$sql = 'DELETE FROM ' . CONFIRM_TABLE . "
WHERE session_id ='" . $userdata['session_id'] . "'";
if (!$db->sql_query($sql))
{
message_die(GENERAL_ERROR, 'Could not delete stale confirm data', '', __LINE__, __FILE__, $sql);
}
}
#
#--------[ SAVE/CLOSE ALL FILES ]----------------
#
# EoM