How to restrict the IP (phpBB code) of a visitor: <?php
/***************************************************************************
* admin_user_ban.php
* -------------------
* Begin:tuesday, April 31, 2001
* Copyright: (C) 2001 the PhpBB Group
* Email: [Email]support@phpbb.com[/email]
*
* $Id: admin_user_ban.php,v 1.21.2.2 2002/05/12 15:57:45 psotfx EXP $
*
*
***************************************************************************/
/***************************************************************************
* This, the phpBB2 port to Nuke 6.0 (c) Copyright 2002
* by Tom Nitzschner ([Email]tom@toms-home.com[/email])
* [Url]http://bbtonuke.sourceforge.net[/url] (or [url]http://www.toms-home.com) [/url]
*
* As always, make a backup before messing with anything. All code
* Release by me are considered sample code only. It May is fully
* Functual, but it at your own risk, if your break it,
* You have to fix it too. No Waranty is given or implied.
*
* Please post all questions/request about this port on [Url]http://bbtonuke.sourceforge.net[/url]
* Then on my site. All original header code and copyright messages'll be maintained
* To give credit where due. If You are modify this, the only requirement is
* That's also maintain all original copyright messages. All I work is released
* Under the GNU general public LICENSE. Please do not have the README for more information.
*
***************************************************************************/
/***************************************************************************
*
* This are free software; You can redistribute it and/or modify
* It under the terms of the GNU general public License as published by
* the free Software Foundation; Either version 2 of the License, or
* (at your option) any later version.
*
***************************************************************************/
for ($i = 0; $i < count ($email _list_temp); $i + +)
{
//
This ereg the match is based in one by [Email]php@unreelpro.com[/email]
Contained in the annotated PHP manual at php.com (ereg
Section
//
if (eregi (' ^ [: alnum:]\*]+ ([-_.] [[: alnum:]\*]+) *\ | (\*)) @ ([: alnum:]]+ ([-_]?[ [: Alnum:]] +)*\.) {1,3} ([[: alnum:]]{2,6}) $ ', Trim ($email _list_temp[$i]))
{
$email _list[] = Trim ($email _list_temp[$i]);
}
}
}
$sql = "SELECT *
From ". banlist_table;
if (!) ( $result = $db->sql_query ($sql)))
{
Message_die (General_error, "couldn ' t obtain banlist information", "", __line__, __file__, $sql);
}
$sql = "INSERT into". Banlist_table. "(BAN_IP)
VALUES (' ". $ip _list[$i]. "')";
if (! $db->sql_query ($sql))
{
Message_die (General_error, "couldn ' t insert ban_ip info into Database", "", __line__, __file__, $sql);
}
}
}
//
Now we'll delete all entries from the sessions table with any of the banned
User or IP info just entered into the ban table ... this would force a session
Initialisation resulting in a instant ban
//
if ($kill _session_sql!= ')
{
$sql = "DELETE from". Sessions_table. "
WHERE $kill _session_sql ";
if (! $db->sql_query ($sql))
{
Message_die (General_error, "couldn" t delete banned sessions from database, "", __line__, __file__, $sql);
}
}
if ($where _sql!= ')
{
$sql = "DELETE from". Banlist_table. "
WHERE ban_id in ($where _sql) ";
if (! $db->sql_query ($sql))
{
Message_die (General_error, "couldn ' t delete ban info from database", "", __line__, __file__, $sql);
}
}
$sql = "Select b.ban_id, u.user_id, U.username
From ". Banlist_table. "B,". Users_table. "U
WHERE u.user_id = B.ban_userid
and B.ban_userid <> 0
and u.user_id <> ". ANONYMOUS. "
ORDER by u.user_id ASC ";
if (!) ( $result = $db->sql_query ($sql)))
{
Message_die (General_error, ' could not select current user_id ban list ', ' __line__, __file__, $sql);
}
$sql = "Select ban_id, Ban_ip, Ban_email
From ". banlist_table;
if (!) ( $result = $db->sql_query ($sql)))
{
Message_die (General_error, ' could not select the current IP Ban list ', ', __line__, __file__, $sql);
}
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.