国产av日韩一区二区三区精品,成人性爱视频在线观看,国产,欧美,日韩,一区,www.成色av久久成人,2222eeee成人天堂

首頁 後端開發(fā) php教程 如何限制訪客的ip(PHPBB的程式碼)_PHP教程

如何限制訪客的ip(PHPBB的程式碼)_PHP教程

Jul 21, 2016 pm 04:09 PM
admin code php use 程式碼 如何 限制


如何限制訪客的ip(PHPBB的程式碼) 代碼: ?
/**************************************************** ******** **********************
* admin_user_ban.php
* --------- ------- ---
* 開始:2001 年7 月31 日星期二
* 版權(quán)所有:(C) 2001 phpBB Group
* 電子郵件:[email]support@phpbb.com [/email]
*
* $Id: admin_user_ban.php,v 1.21.2.2 2002/05/12 15:57:45 psotfx Exp $
*
*
*
*** ********* ***************************************** ***************** ***************/

/**************************************************** ******** **********************
* 此檔案是phpBB2 移植到Nuke 6.0 的一部份(c) 版權(quán)所有2002
* 作者:Tom Nitzschner ([email]tom@toms-home.com[/email])
* [url]http://bbtonuke.sourceforge.net[/url] (或[url]http ://www.toms-home .com)[/url]
*
* 一如既往,在搞亂任何東西之前先進行備份。我發(fā)布的所有程式碼
*僅被視為範(fàn)例程式碼。它可能完全
*功能,但您使用它需要您自擔(dān)風(fēng)險,如果您破壞它,
*您也可以修復(fù)它。不提供或暗示任何保證。
*
* 請先在 [url]http://bbtonuke.sourceforge.net[/url] 上發(fā)布有關(guān)此連接埠的所有問題/請求,
* 然後在我的地點。所有原始標(biāo)題代碼和版權(quán)訊息將保留
*,以在應(yīng)得的信用處給予信用。如果您修改此內(nèi)容,唯一的要求是
*您也保留所有原始版權(quán)訊息。我的所有作品均在 GNU 通用公共許可證下發(fā)布
*。請參閱自述文件以獲取更多資訊。
*
**************************************** *** ****************************************/

/**************************************************** ******** **********************
*
* 程式是免費軟體;您可以根據(jù)
*自由軟體基金會發(fā)布的GNU通用公共授權(quán)條款重新分發(fā)和/或修改
*它;許可證版本2,或
*(由您選擇)任何更高版本。
*
************************ ******************* *************************************** ***/

定義('IN_PHPBB' , 1);

if ( !empty($setmodules) )
{
$filename = basename(__FILE__);
$module['Users'][' Ban_Management'] = $filename;

return;
}

//
//載入預(yù)設(shè)標(biāo)頭
//
$phpbb_path_path = './root./' ;
require($phpbb_root_path . 'extension.inc');
require('./pagestart.' . $phpEx);

//
// 啟動程式

//
// 啟動程式
//
if ( isset($HTTP_POST_VARS['submit']) )
{
$user_bansql = '';
$email_bansql = '';
$ip_bansql = '';

$user_list = array();
if ( !empty($HTTP_POST_VARS['用戶名']) )
{
$this_userdata = get_userdata($HTTP_POST_VARS['用戶名') ]);
if( !$this_userdata )
{
message_die(GENERAL_MESSAGE, $lang['No_user_id_specified']);
}
}

$ip_list = array();
if ( isset($HTTP_POST_VARS['ban_ip']) )
{
$ip_listtemp_explode( ',', $HTTP_POST_VARS['ban_ip']);

for($i = 0; $i {
if ( preg_match( ' /^([0-9]{1,3}).([0-9]{1,3}).([0-9]{1,3}).([0-9]{1 , 3})[ ]*-[ ]*([0-9]{1,3}).([0-9]{1,3}).([0-9]{1,3})。 ([0-9]{1,3})$/', trim($ip_list_temp[$i]), $ip_range_explode) )
{
//
// 不問所有這個,別問了...!為什麼
//
$ip_1_counter = $ip_range_explode[1];
$ip_1_end = $ip_range_explode[5];

while ( $ ip_1_counter $ip_2_counter = ( $ip_1_counter == $ip_range_explode[1] ) ? $ip_range_explode[2] : 0;
$ip_2_end = ( $ip_1_counter if ( $ip_2_counter == 0 && $ip_2_end == 254 )
{
$ip_2_counter = 255;
$ip_2_fragment = 2555;}

while ( $ip_2_counter {
$ip_3_counter = (ip_2_count; $ip_1_counter == $ip_range_explode[1] ) ? $ip_range_explode[3] : 0;
$ip_3_end = ( $ip_2_counter $ip_1_counter
if ( $ip_3_counter == 0 && $ip_3_end == 254 )
{
$ip_3_counter = 255;
$ip_3_fragment = 2555; encode_ip("$ip_1_counter.$ip_2_counter.255.255");
}

while ( $ip_3_counter {
$. 3] && $ip_2_counter == $ip_range_explode[2] && $ip_1_counter == $ip_range_explode[1] ) ? $ip_range_explode[4] : 0;
$ip_4_end = ( $ip_3_counter
if ( $ip_4_counter == 0 && $ip_4_end == 254 )
{
$ip_4_counter = 254 )
{
$ip_4_counter = 2555; 255;

$ip_list[] =encode_ip("$ip_1_counter.$ip_2_counter.$ip_3_counter.255");
}

while ( $ip_4_counter {
$ip_list[] =encode_ip("$ip_1_counter.$ip_2_counter.$ip_3_counter.$ipcount_counter.$ip4_counter");
}
$ip_3_counter ;
}
$ip_2_counter ;
}
$ip_1_counter ;
}<_>{
$ip = gethostbynamel(trim($ip_list_temp[$i]) ) ;

for($j = 0; $j {
if ( !empty($ip[$j]) )
{
$ip_list[] =encode_ip($ip[$j]);
}
}
}
else if ( preg_match('/^([0-9]{ 1, 3}).([0-9*]{1,3}).([0-9*]{1,3}).([0-9*]{1,3})$/' , 剪刀($ip_list_temp[$i])) )
{
$ip_list[] = 編碼_ip(str_replace('*', '255', 修剪($ip_list_temp[$i])));
}
}
}

$email_list = array();
if ( isset($HTTP_POST_VARS['ban_email']) )
{
$e_list_tempmail']) )
{
$e_list_tempmail'] (',', $HTTP_POST_VARS['ban_email']);

for($i = 0; $i {
//{
//
// 此ereg 匹配基於[email]php@unreelpro.com[/email]
// 包含在php.com 帶註釋的php 手冊(ereg
// 部分)
//
if ( eregi('^(([[:alnum:]*] ([-_.][[:alnum:]*] )*.?)|(*))@([[ :alnum:]] ([-_]?[[:alnum:]] )*.){1,3}([[:alnum:]]{2,6})$', 修剪($email_list_temp[$ i])) )
{
$email_list[] = trim($email_list_temp[$i]);
}
}
}

$sql = "SELECT *
來自」。 BANLIST_TABLE;
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, "無法取得黑名單資訊", "", __LINE__, __FILE__ , $ sql);
}

$current_banlist = $db->sql_fetchrowset($result);
$db->sql_freeresult($result);

$kill_session_freeresult($result);

$kill_session_sql ='' ;
for($i = 0; $i {
$in_banlist = false;
for($j = 0; $j {
if ( $user_list[$i] == $current_banlist[$j]['ban_userid'] )
{
$ in_banlist = true;
}
}

if (!$in_banlist)
{
$kill_session_sql .= (( $kill_session_sql != '' ) ? ' 或' : ' ')。 user_list[$i];

$sql = "插入"。 !$db->sql_query($sql) )
{
message_die(GENERAL_ERROR, "無法將ban_userid 信息插入數(shù)據(jù)庫", "", __LINE__, __FILE__, $sql);
}
}
}

for($i = 0; $i {
$in_banlist = false;
for($j = 0; $j {
if ( $ip_list[$i] == $current_banlist[$j]['ban_ip'] )
{
$in_banlist = true ;
}
}

if ( !$in_banlist )
{
if ( preg_match('/(ff.)|(.ff)/is' , chunk_split($ ip_list[$i], 2, '.')) )
{
$kill_ip_sql = "session_ip LIKE '" . str_replace('.', '', preg_replace('/(ff.)|(.ff)/is', '%', chunk_split($ip_list[$i], 2, "."))) 。 ";
}
else
{
$kill_ip_sql = "session_ip = '" . $ip_list[$i] 。 ??>$sql = "插入" 。 sql) )
{
message_die( GENERAL_ERROR, "無法將ban_ip 資訊插入資料庫", "", __LINE__, __FILE__, $sql);
}
}
}


}
}


}
}


}
}


//
//現(xiàn)在我們報表會話表中刪除所有被禁止的邊界
//剛剛輸入隊列表的用戶或IP資訊...這將強制會話
//初始化導(dǎo)致即時現(xiàn)場
//
if ( $kill_session_sql != '' )
{
$sql = "DELETE FROM " .會話表。 !$db->sql_query($sql) )
{
message_die(GENERAL_ERROR, "無法從資料庫中刪除禁止的會話", "" , __LINE__, __FILE__, $sql);
}
}
}

for($i = 0; $i {
$in_banlist = false;
for($j = 0; $ j {
if ( $email_list[$i] == $current_banlist[$j ]['ban_email'] )
{
$in_banlist = true;
}
}

if ( !$in_banlist )
{
$sql = "插入「.禁止名單表。 " .str_replace("'", "''", $email_list[$i]) . "')";
if (!$db->sql_query($ sql) )
{
message_die (GENERAL_ERROR, "無法將ban_email 資訊插入資料庫", "", __LINE__, __FILE__, $sql);
}
}
}

$where_ '';if ( isset($HTTP_POST_VARS['unban_user']) )
{
$user_list = $HTTP_POST_VARS['unban_user'];

for($i = 0; $i {
if ( $user_list[$i] != -1 )
{
$where_sql .= (($where_sql!= '') ? ', ': '' $user_list[$i];
}
}
}

if ( isset($HTTP_POST_VARS['unban_ip']) )
{
$ip_list = $TP_$ ['unban_ip'];

for($i = 0; $i {
if ( $ip_list[$i] != - 1 )
{$where_sql .= (( $where_sql != '' ) ? ', ' : '' ) 。

if ( isset($HTTP_POST_VARS['unban_email']) )
{
$email_list = $HTTP_POST_VARS['unban_email'];

; $i {
if ( $email_list[$i] != -1 )
{
$where_sql .= ( ( $where_sql != '')?' ,':'')。 = "從" 刪除。 "無法從資料庫中刪除禁制令資訊", "", __LINE__, __FILE__, $sql);
}
}

$message = $lang['Ban_update_sucessful'] 。 >
'' 。

'' 。 /a>');

message_die(GENERAL_MESSAGE, $message);

}
else
{
$template->set_names(array' body' => 'admin /user_ban_body.tpl')
);

$template->assign_vars(array(
'L_BAN_TITLE' => $lang['Ban_control'],
'L_BAN_EXPLAIN' = > $lang['Ban_explain'],
'L_BAN_EXPLAIN_WARN' => $lang['Ban_explain_warn'],
'L_IP_OR_HOSTNAME' = $lang_EMA['],
'L_IP_OR_HOSTNAME' = $RDR]['] ' => $lang['電子郵件地址'],
'L_SUBMIT' => $lang['提交'],
'L_RESET' => $lang['重置'],

'S_BANLIST_ACTION' =>append_sid("admin_user_ban.$phpEx"))
);

$template->assign_vars(array(
'L_BAN_US_o_> $name'[]]]]]> $SSonfffffnname'_> $SAN_USS> $name'SAN_USS> $name'SAN_USS> $name'SAN_USS> $name'SAN_USS> $name'SAN_USS> $name'SAN_USS> $name'SAN_USS> $name'SAN_USS> $name'SAN_USS> $name'SAN_USS> $name'SAN_USS> $name'Y]]]]'Sjname'sname'Somefffan’Spaname'SweAN_USSname'_> $name'Y]]]]> $name' ],
'L_BAN_USER_EXPLAIN' => $lang['Ban_username_explain'],
'L_BAN_IP' => $lang['Ban_IP'],
'L_BAN_IP_EXPLAIN' => $lang_Ban_d]
'L_BAN_EMAIL' => $lang['Ban_email'],
'L_BAN_EMAIL_EXPLAIN' => $lang['Ban_email_explain'])
);

$userban_count = 0; >$ipban_count = 0;
$emailban_count = 0;

$sql = "SELECT b.ban_id, u.user_id, u.username
FROM " 。禁止名單表。 「b」。用戶表。 “ u
其中 u.user_id = b.ban_userid
AND b.ban_userid 0
AND u.user_id ” 。匿名的 。 "
ORDER BY u.user_id ASC";
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, '無法選擇當(dāng)前user_id 禁止列表', '', __LINE__, __FILE__, $sql);
}

$user_list = $db->sql_fetchrowset($result);
$db->sql_freeresult( $result);

$select_userlist = '';
for($i = 0; $i {
$select_userlist .= '' . $user_list[$i]['用戶名'] 。'';
$userban_count ;
}

if( $select_userlist == '' )
{
$select_userlist = '' 。 ';
}

$select_userlist = '' 。 select name="unban_email[]" multiple="multiple" size="5">' 。 ' => $lang['Unban_username'],
'L_UNBAN_USER_EXPLAIN' => $ lang['Unban_username_explain'],
'L_UNBAN_IP' => $lang['Unban_IP'],
'L_UNBAN_IP' => $lang['Unban_IP'],
'L_UNIN_IP' => $UN -'Unban_IP'],
> $lang['Unban_IP_explain'],
'L_UNBAN_EMAIL' => $lang['Unban_email'],
'L_UNBAN_EMAIL_EXPLAIN' => $lang['Unban_email_explain'], lang['使用者名稱'],
'L_LOOK_UP' => ; $lang['Look_up_User'],
'L_FIND_USERNAME' => $lang['Find_username'],

'U_ARCSEH_USER' =>append_sid("search.$phpEx?mode=searchuser&popup= 1&menu=1"),
'S_UNBAN_USERLIST_SELECT' => $select_userlist,
'S_UNBAN_IPLIST_SELECT> $c. $select_emaillist,
'S_BAN_ACTION' => ;append_sid("admin_user_ban.$phpEx"))
);
}

$template->pparse('body');

$template->pparse('body');

$template->pparse('body');

$template->pparse('body'); >
include('./page_footer_admin .'.$phpEx);

?>

http://www.bkjia.com/PHPjc/314527.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/314527.htmlTechArticle如何限制訪客的ip(PHPBB的代碼)Code:?php /******** ************************************************** ******** ****** ****************** * admin_user_ban.php * ------------- --------- *開始...
本網(wǎng)站聲明
本文內(nèi)容由網(wǎng)友自願投稿,版權(quán)歸原作者所有。本站不承擔(dān)相應(yīng)的法律責(zé)任。如發(fā)現(xiàn)涉嫌抄襲或侵權(quán)的內(nèi)容,請聯(lián)絡(luò)admin@php.cn

熱AI工具

Undress AI Tool

Undress AI Tool

免費脫衣圖片

Undresser.AI Undress

Undresser.AI Undress

人工智慧驅(qū)動的應(yīng)用程序,用於創(chuàng)建逼真的裸體照片

AI Clothes Remover

AI Clothes Remover

用於從照片中去除衣服的線上人工智慧工具。

Clothoff.io

Clothoff.io

AI脫衣器

Video Face Swap

Video Face Swap

使用我們完全免費的人工智慧換臉工具,輕鬆在任何影片中換臉!

熱工具

記事本++7.3.1

記事本++7.3.1

好用且免費的程式碼編輯器

SublimeText3漢化版

SublimeText3漢化版

中文版,非常好用

禪工作室 13.0.1

禪工作室 13.0.1

強大的PHP整合開發(fā)環(huán)境

Dreamweaver CS6

Dreamweaver CS6

視覺化網(wǎng)頁開發(fā)工具

SublimeText3 Mac版

SublimeText3 Mac版

神級程式碼編輯軟體(SublimeText3)

我如何了解最新的PHP開發(fā)和最佳實踐? 我如何了解最新的PHP開發(fā)和最佳實踐? Jun 23, 2025 am 12:56 AM

TostaycurrentwithPHPdevelopmentsandbestpractices,followkeynewssourceslikePHP.netandPHPWeekly,engagewithcommunitiesonforumsandconferences,keeptoolingupdatedandgraduallyadoptnewfeatures,andreadorcontributetoopensourceprojects.First,followreliablesource

什麼是PHP,為什麼它用於Web開發(fā)? 什麼是PHP,為什麼它用於Web開發(fā)? Jun 23, 2025 am 12:55 AM

PHPbecamepopularforwebdevelopmentduetoitseaseoflearning,seamlessintegrationwithHTML,widespreadhostingsupport,andalargeecosystemincludingframeworkslikeLaravelandCMSplatformslikeWordPress.Itexcelsinhandlingformsubmissions,managingusersessions,interacti

如何設(shè)置PHP時區(qū)? 如何設(shè)置PHP時區(qū)? Jun 25, 2025 am 01:00 AM

tosetTherightTimeZoneInphp,restate_default_timezone_set()functionAtthestArtofyourscriptWithavalIdidentIdentifiersuchas'america/new_york'.1.usedate_default_default_timezone_set_set()

我如何驗證PHP中的用戶輸入以確保其符合某些標(biāo)準(zhǔn)? 我如何驗證PHP中的用戶輸入以確保其符合某些標(biāo)準(zhǔn)? Jun 22, 2025 am 01:00 AM

TovalidateuserinputinPHP,usebuilt-invalidationfunctionslikefilter_var()andfilter_input(),applyregularexpressionsforcustomformatssuchasusernamesorphonenumbers,checkdatatypesfornumericvalueslikeageorprice,setlengthlimitsandtrimwhitespacetopreventlayout

什麼是php(serialize(),Unserialize())中的數(shù)據(jù)序列化? 什麼是php(serialize(),Unserialize())中的數(shù)據(jù)序列化? Jun 22, 2025 am 01:03 AM

thephpfunctionserize()andunSerialize()redustoconvertComplexdatStructDestoresToroStoroStoroSandaBackagagain.1.Serialize()

如何將PHP代碼嵌入HTML文件中? 如何將PHP代碼嵌入HTML文件中? Jun 22, 2025 am 01:00 AM

可以將PHP代碼嵌入HTML文件中,但需確保文件以.php為擴展名,以便服務(wù)器能正確解析。使用標(biāo)準(zhǔn)的標(biāo)籤包裹PHP代碼,可在HTML中任意位置插入動態(tài)內(nèi)容。此外,可在同一文件中多次切換PHP與HTML,實現(xiàn)條件渲染等動態(tài)功能。務(wù)必注意服務(wù)器配置及語法正確性,避免因短標(biāo)籤、引號錯誤或遺漏結(jié)束標(biāo)籤導(dǎo)致問題。

編寫清潔和可維護的PHP代碼的最佳實踐是什麼? 編寫清潔和可維護的PHP代碼的最佳實踐是什麼? Jun 24, 2025 am 12:53 AM

寫乾淨(jìng)、易維護的PHP代碼關(guān)鍵在於清晰命名、遵循標(biāo)準(zhǔn)、合理結(jié)構(gòu)、善用註釋和可測試性。 1.使用明確的變量、函數(shù)和類名,如$userData和calculateTotalPrice();2.遵循PSR-12標(biāo)準(zhǔn)統(tǒng)一代碼風(fēng)格;3.按職責(zé)拆分代碼結(jié)構(gòu),使用MVC或Laravel式目錄組織;4.避免麵條式代碼,將邏輯拆分為單一職責(zé)的小函數(shù);5.在關(guān)鍵處添加註釋並撰寫接口文檔,明確參數(shù)、返回值和異常;6.提高可測試性,採用依賴注入、減少全局狀態(tài)和靜態(tài)方法。這些做法提升代碼質(zhì)量、協(xié)作效率和後期維護便利性。

如何使用PHP執(zhí)行SQL查詢? 如何使用PHP執(zhí)行SQL查詢? Jun 24, 2025 am 12:54 AM

Yes,youcanrunSQLqueriesusingPHP,andtheprocessinvolveschoosingadatabaseextension,connectingtothedatabase,executingqueriessafely,andclosingconnectionswhendone.Todothis,firstchoosebetweenMySQLiorPDO,withPDObeingmoreflexibleduetosupportingmultipledatabas

See all articles