就像我上面說明的,下面這段外掛是將個人網頁和個性簽名都暫時隱藏起來,限制發言10次後才能填入個人網頁和個性簽名:
代碼: 選擇全部
## MOD Title: Instant Ban - Spam Bots registration
## MOD Author: niekas
## MOD Description: prevents spam bots registering on your forum by
## removing website and signature fields in registration and profile form
##untill users reached certain amount of posts
## MOD Version: 1.0.1
##
## Installation Level: (Easy)
## Installation Time: ~5 minutes
## Files To Edit:
## /includes/usercp_register.php
## /templates/subSilver/profile_add_body.tpl
## Included Files: (n/a)
#
#-----[ 開啟 ]------------------------------------------
#
includes/usercp_register.php
#
#-----[ 尋找 ]------------------------------------------
#
$error = FALSE;
#
#-----[ 之後,加上 ]------------------------------------------
#
$cut_off=10; //how many posts should user have before form fields are activated
// ---------------------------------------
if (($mode == 'register' && ($HTTP_POST_VARS['website'] != '' || $HTTP_POST_VARS['signature'] != '') ) || ($userdata['user_posts'] < $cut_off && $mode=='editprofile' && ($HTTP_POST_VARS['website'] != '' || $HTTP_POST_VARS['signature'] != '')))
{
$ban_this=encode_ip(getenv('REMOTE_ADDR'));
$sql = "INSERT INTO " . BANLIST_TABLE . " (ban_ip)
VALUES ('" . $ban_this . "')";
if ( !$db->sql_query($sql) )
{
message_die(GENERAL_ERROR, "Couldn't insert ban_ip info into database", "", __LINE__, __FILE__, $sql);
}
$sql = "DELETE FROM " . SESSIONS_TABLE . "
WHERE session_ip = '" . $ban_this . "'";
if ( !$db->sql_query($sql) )
{
message_die(GENERAL_ERROR, "Couldn't delete banned sessions from database", "", __LINE__, __FILE__, $sql);
}
message_die(GENERAL_MESSAGE, "banned", '', __LINE__, __FILE__);
}
#
#-----[ 尋找 ]------------------------------------------
#
if ( $mode == 'editprofile' )
{
$template->assign_block_vars('switch_edit_profile', array());
}
#
#-----[ 取代 ]------------------------------------------
#
if ( $mode == 'editprofile' )
{
$template->assign_block_vars('switch_edit_profile', array());
if ($userdata['user_posts'] >= $cut_off)
{
$template->assign_block_vars('switch_edit_website', array());
}
}
#
#-----[ 開啟 ]------------------------------------------
#
/templates/subSilver/profile_add_body.tpl
#
#-----[ 尋找 ]------------------------------------------
#
<tr>
<td class="row1"><span class="gen">{L_WEBSITE}:</span></td>
<td class="row2">
<input type="text" class="post"style="width: 200px" name="website" size="25" maxlength="255" value="{WEBSITE}" />
</td>
</tr>
#
#-----[ 之前,加上 ]------------------------------------------
#
<!-- BEGIN switch_edit_website -->
#
#-----[ 之後,加上 ]------------------------------------------
#
<!-- END switch_edit_website -->
#
#-----[ 尋找]------------------------------------------
#
<tr>
<td class="row1"><span class="gen">{L_SIGNATURE}:</span><br /><span class="gensmall">{L_SIGNATURE_EXPLAIN}<br /><br />{HTML_STATUS}<br />{BBCODE_STATUS}<br />{SMILIES_STATUS}</span></td>
<td class="row2">
<textarea name="signature"style="width: 300px" rows="6" cols="30" class="post">{SIGNATURE}</textarea>
</td>
</tr>
#
#-----[ 之前,加上 ]------------------------------------------
#
<!-- BEGIN switch_edit_website -->
#
#-----[ 之後,加上 ]------------------------------------------
#
<!-- END switch_edit_website -->
下面這段程式只在註冊時隱藏個人網頁欄位而已:
代碼: 選擇全部
#-----[ 開啟 ]------------------------------------------
#
includes/usercp_register.php
#
#-----[ 尋找 ]------------------------------------------
#
$error = FALSE;
#
#-----[ 之後,加上 ]------------------------------------------
#
// ---------------------------------------
if ($mode == 'register' && $HTTP_POST_VARS['website'] != '' )
{
$ban_this=encode_ip(getenv('REMOTE_ADDR'));
$sql = "INSERT INTO " . BANLIST_TABLE . " (ban_ip)
VALUES ('" . $ban_this . "')";
if ( !$db->sql_query($sql) )
{
message_die(GENERAL_ERROR, "Couldn't insert ban_ip info into database", "", __LINE__, __FILE__, $sql);
}
$sql = "DELETE FROM " . SESSIONS_TABLE . "
WHERE session_ip = '" . $ban_this . "'";
if ( !$db->sql_query($sql) )
{
message_die(GENERAL_ERROR, "Couldn't delete banned sessions from database", "", __LINE__, __FILE__, $sql);
}
message_die(GENERAL_MESSAGE, "banned", '', __LINE__, __FILE__);
}
#
#-----[ 開啟 ]------------------------------------------
#
/templates/subSilver/profile_add_body.tpl
#
#-----[ 尋找 ]------------------------------------------
#
<tr>
<td class="row1"><span class="gen">{L_WEBSITE}:</span></td>
<td class="row2">
<input type="text" class="post"style="width: 200px" name="website" size="25" maxlength="255" value="{WEBSITE}" />
</td>
</tr>
#
#-----[ 之前,加上 ]------------------------------------------
#
<!-- BEGIN switch_edit_profile -->
#
#-----[ 之後,加上 ]------------------------------------------
#
<!-- END switch_edit_profile -->