mirror of
https://github.com/e107inc/e107.git
synced 2025-08-03 21:27:25 +02:00
Failed login attempts administration ready
This commit is contained in:
@@ -1,20 +1,18 @@
|
|||||||
<?php
|
<?php
|
||||||
/*
|
/*
|
||||||
+ ----------------------------------------------------------------------------+
|
* e107 website system
|
||||||
| e107 website system
|
*
|
||||||
|
|
* Copyright (C) 2001-2008 e107 Inc (e107.org)
|
||||||
| <20>Steve Dunstan 2001-2002
|
* Released under the terms and conditions of the
|
||||||
| http://e107.org
|
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
|
||||||
| jalist@e107.org
|
*
|
||||||
|
|
* Manage/View failed login attempts
|
||||||
| Released under the terms and conditions of the
|
*
|
||||||
| GNU General Public License (http://gnu.org).
|
* $Source: /cvs_backup/e107_0.8/e107_admin/fla.php,v $
|
||||||
|
|
* $Revision: 1.6 $
|
||||||
| $Source: /cvs_backup/e107_0.8/e107_admin/fla.php,v $
|
* $Date: 2008-12-23 16:25:06 $
|
||||||
| $Revision: 1.5 $
|
* $Author: secretr $
|
||||||
| $Date: 2008-11-29 13:24:17 $
|
*
|
||||||
| $Author: e107steved $
|
|
||||||
+----------------------------------------------------------------------------+
|
|
||||||
*/
|
*/
|
||||||
require_once("../class2.php");
|
require_once("../class2.php");
|
||||||
if (!getperms("4"))
|
if (!getperms("4"))
|
||||||
@@ -26,6 +24,12 @@ if (!getperms("4"))
|
|||||||
$e_sub_cat = 'failed_login';
|
$e_sub_cat = 'failed_login';
|
||||||
require_once("auth.php");
|
require_once("auth.php");
|
||||||
|
|
||||||
|
require_once(e_HANDLER."form_handler.php");
|
||||||
|
$frm = new e_form();
|
||||||
|
|
||||||
|
require_once(e_HANDLER."message_handler.php");
|
||||||
|
$emessage = &eMessage::getInstance();
|
||||||
|
|
||||||
$tmp = (e_QUERY) ? explode(".", e_QUERY) : "";
|
$tmp = (e_QUERY) ? explode(".", e_QUERY) : "";
|
||||||
$from = intval(varset($tmp[0], 0));
|
$from = intval(varset($tmp[0], 0));
|
||||||
$amount = intval(varset($tmp[1], 50));
|
$amount = intval(varset($tmp[1], 50));
|
||||||
@@ -59,7 +63,9 @@ function deleteBan($banID, $banIP = '')
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* FIXME - refine messages (strange messages on delete all & reload)
|
||||||
|
*/
|
||||||
if(isset($_POST['delbanSubmit']))
|
if(isset($_POST['delbanSubmit']))
|
||||||
{
|
{
|
||||||
$message = '';
|
$message = '';
|
||||||
@@ -72,8 +78,7 @@ if(isset($_POST['delbanSubmit']))
|
|||||||
}
|
}
|
||||||
if ($delcount)
|
if ($delcount)
|
||||||
{
|
{
|
||||||
$message .= FLALAN_3.": ".$delcount;
|
$emessage->add(FLALAN_3.": ".$delcount, E_MESSAGE_SUCCESS);
|
||||||
$spacer = '<br />';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$bancount = 0;
|
$bancount = 0;
|
||||||
@@ -84,16 +89,16 @@ if(isset($_POST['delbanSubmit']))
|
|||||||
$at = $sql->db_Fetch();
|
$at = $sql->db_Fetch();
|
||||||
if (!$e107->add_ban(4, FLALAN_4, $at['gen_ip'], ADMINID))
|
if (!$e107->add_ban(4, FLALAN_4, $at['gen_ip'], ADMINID))
|
||||||
{ // IP on whitelist (although possibly we shouldn't get to this stage, but check anyway
|
{ // IP on whitelist (although possibly we shouldn't get to this stage, but check anyway
|
||||||
$message .= $spacer.str_replace(FLALAN_18,'--IP--',$at['gen_ip']);
|
$emessage->add(str_replace(FLALAN_18,'--IP--',$at['gen_ip']), E_MESSAGE_WARNING);
|
||||||
$spacer = '<br />';
|
|
||||||
}
|
}
|
||||||
// $banlist_ip = $at['gen_ip'];
|
else $bancount++;
|
||||||
|
$banlist_ip = $at['gen_ip'];
|
||||||
|
//XXX - why inserting it twice?
|
||||||
//$sql->db_Insert("banlist", "'$banlist_ip', '".ADMINID."', '".FLALAN_4."' ");
|
//$sql->db_Insert("banlist", "'$banlist_ip', '".ADMINID."', '".FLALAN_4."' ");
|
||||||
$sql->db_Delete("generic", "gen_id='{$ban}' ");
|
$sql->db_Delete("generic", "gen_id='{$ban}' ");
|
||||||
$bancount ++;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$message .= $spacer.FLALAN_5.": ".$bancount;
|
$emessage->add(FLALAN_5.": ".$bancount, $bancount ? E_MESSAGE_SUCCESS : E_MESSAGE_INFO);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -107,7 +112,8 @@ if(e_QUERY == "dabl")
|
|||||||
$delcount++;
|
$delcount++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$message = FLALAN_17;
|
//XXX - add delcount to the message
|
||||||
|
$emessage->add(FLALAN_17, E_MESSAGE_SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -121,20 +127,16 @@ if($sql -> db_Select("generic", "*", "gen_type='auto_banned' ORDER BY gen_datest
|
|||||||
$message .= " - ".$ab['gen_ip'];
|
$message .= " - ".$ab['gen_ip'];
|
||||||
}
|
}
|
||||||
|
|
||||||
$message .= "<div style='text-align: right;'>( <a href='".e_SELF."?dabl'>".FLALAN_16."</a> )</div>";
|
$message .= "<div class='right'>( <a href='".e_SELF."?dabl'>".FLALAN_16."</a> )</div>";
|
||||||
|
$emessage->add($message);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($message))
|
|
||||||
{
|
|
||||||
$ns->tablerender("", "<div style='text-align:center'><b>".$message."</b></div>");
|
|
||||||
}
|
|
||||||
|
|
||||||
$gen = new convert;
|
$gen = new convert;
|
||||||
$fla_total = $sql->db_Count("generic", "(*)", "WHERE gen_type='failed_login'");
|
$fla_total = $sql->db_Count("generic", "(*)", "WHERE gen_type='failed_login'");
|
||||||
if(!$sql->db_Select("generic", "*", "gen_type='failed_login' ORDER BY gen_datestamp DESC LIMIT {$from},{$amount}"))
|
if(!$sql->db_Select("generic", "*", "gen_type='failed_login' ORDER BY gen_datestamp DESC LIMIT {$from},{$amount}"))
|
||||||
{
|
{
|
||||||
$text = "<div style='text-align: center;'>".FLALAN_2."</div>";
|
$text = $emessage->render()."<div class='center'>".FLALAN_2."</div>";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -143,64 +145,101 @@ else
|
|||||||
|
|
||||||
$text = "
|
$text = "
|
||||||
<form method='post' action='".e_SELF."' id='flaform' >
|
<form method='post' action='".e_SELF."' id='flaform' >
|
||||||
<table class='fborder' style='width:99%;'>
|
<fieldset id='core-fla'>
|
||||||
|
<legend class='e-hideme'>".FLALAN_1."</legend>
|
||||||
|
<table cellpadding='0' cellspacing='0' class='adminlist'>
|
||||||
|
<colgroup span='5'>
|
||||||
|
<col style='width: 20%'></col>
|
||||||
|
<col style='width: 40%'></col>
|
||||||
|
<col style='width: 20%'></col>
|
||||||
|
<col style='width: 10%'></col>
|
||||||
|
<col style='width: 10%'></col>
|
||||||
|
</colgroup>
|
||||||
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<td style='width: 20%;' class='forumheader'>".FLALAN_6."</td>
|
<th>".FLALAN_6."</th>
|
||||||
<td style='width: 50%;' class='forumheader'>".FLALAN_7."</td>
|
<th>".FLALAN_7."</th>
|
||||||
<td style='width: 20%;' class='forumheader'>".FLALAN_8."</td>
|
<th>".FLALAN_8."</th>
|
||||||
<td style='width: 10%; text-align: center;' class='forumheader'>".FLALAN_9."</td>
|
<th class='center last'>
|
||||||
|
".LAN_DELETE."<br/>
|
||||||
|
".$frm->checkbox('check_all_del', 'jstarget:fladelete', false, array('id'=>false,'class'=>'checkbox toggle-all'))."
|
||||||
|
</th>
|
||||||
|
<th class='center last'>
|
||||||
|
".LAN_BAN."<br/>
|
||||||
|
".$frm->checkbox('check_all_ban', 'jstarget:flaban', false, array('id'=>false,'class'=>'checkbox toggle-all'))."
|
||||||
|
</th>
|
||||||
</tr>
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
";
|
";
|
||||||
|
|
||||||
foreach($faArray as $fa)
|
foreach($faArray as $fa)
|
||||||
{
|
{
|
||||||
extract($fa);
|
extract($fa);//FIXME kill extract()
|
||||||
|
|
||||||
$host = $e107->get_host_name(getenv($gen_ip));
|
$host = $e107->get_host_name(getenv($gen_ip));
|
||||||
$text .= "<tr>
|
$text .= "
|
||||||
<td style='width: 20%;' class='forumheader3'>".$gen->convert_date($gen_datestamp, "forum")."</td>
|
<tr>
|
||||||
<td style='width: 50%;' class='forumheader3'>".str_replace(":::", "<br />", htmlentities($gen_chardata, ENT_QUOTES, CHARSET))."</td>
|
<td>".$gen->convert_date($gen_datestamp, "forum")."</td>
|
||||||
<td style='width: 20%;' class='forumheader'>".$fa['gen_ip']."<br />{$host}</td>
|
<td>".str_replace(":::", "<br />", htmlentities($gen_chardata, ENT_QUOTES, CHARSET))."</td>
|
||||||
<td style='width: 10%; text-align: left;' class='forumheader3'>
|
<td>".$e107->ipDecode($fa['gen_ip'])."<br />{$host}</td>
|
||||||
<input type='checkbox' name='fladelete[]' value='{$gen_id}' /> ".LAN_DELETE."<br />
|
<td class='center middle autocheck e-pointer'>
|
||||||
<input type='checkbox' name='flaban[]' value='{$gen_id}' /> ".LAN_BAN."
|
".$frm->checkbox('fladelete[]', $gen_id)."
|
||||||
|
</td>
|
||||||
|
<td class='center middle autocheck e-pointer'>
|
||||||
|
".$frm->checkbox('flaban[]', $gen_id)."
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
";
|
";
|
||||||
}
|
}
|
||||||
|
|
||||||
$text .= "
|
$text .= "
|
||||||
<tr>
|
</tbody>
|
||||||
<td colspan='4' class='forumheader' style='text-align: right;'>
|
|
||||||
|
|
||||||
<a href='".e_SELF."?checkall=1' onclick=\"setCheckboxes('flaform', true, 'fladelete[]'); return false;\">".FLALAN_11."</a> -
|
|
||||||
<a href='".e_SELF."' onclick=\"setCheckboxes('flaform', false, 'fladelete[]'); return false;\">".FLALAN_12."</a>
|
|
||||||
<br />
|
|
||||||
<a href='".e_SELF."?checkall=1' onclick=\"setCheckboxes('flaform', true, 'flaban[]'); return false;\">".FLALAN_13."</a> -
|
|
||||||
<a href='".e_SELF."' onclick=\"setCheckboxes('flaform', false, 'flaban[]'); return false;\">".FLALAN_14."</a>
|
|
||||||
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
|
|
||||||
<tr>
|
|
||||||
<td colspan='4' class='forumheader' style='text-align: center;'><input class='button' type='submit' name='delbanSubmit' value='".FLALAN_10."' /></td>
|
|
||||||
</tr>
|
|
||||||
</table>
|
</table>
|
||||||
|
<div class='buttons-bar center'>
|
||||||
|
".$frm->admin_button('delbanSubmit', FLALAN_10, 'delete',FLALAN_10,'title=')."
|
||||||
|
</div>
|
||||||
|
</fieldset>
|
||||||
</form>
|
</form>
|
||||||
<div style='text-align:center'><br />
|
|
||||||
";
|
";
|
||||||
|
|
||||||
$parms = $fla_total.",".$amount.",".$from.",".e_SELF.'?'."[FROM].".$amount;
|
$parms = $fla_total.",".$amount.",".$from.",".e_SELF.'?'."[FROM].".$amount;
|
||||||
$text .= $tp->parseTemplate("{NEXTPREV={$parms}}");
|
$nextprev = $tp->parseTemplate("{NEXTPREV={$parms}}");
|
||||||
|
if ($nextprev) $text .= "<div class='nextprev-bar'>".$nextprev."</div>";
|
||||||
|
|
||||||
$text .= "</div>";
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$ns->tablerender(FLALAN_1, $text);
|
$e107->ns->tablerender(FLALAN_1, $emessage->render().$text);
|
||||||
|
|
||||||
require_once("footer.php");
|
require_once("footer.php");
|
||||||
|
/**
|
||||||
|
* Handle page DOM within the page header
|
||||||
|
*
|
||||||
|
* @return string JS source
|
||||||
|
*/
|
||||||
|
function headerjs()
|
||||||
|
{
|
||||||
|
require_once(e_HANDLER.'js_helper.php');
|
||||||
|
$ret = "
|
||||||
|
<script type='text/javascript'>
|
||||||
|
//add required core lan - delete confirm message
|
||||||
|
(".e_jshelper::toString(LAN_JSCONFIRM).").addModLan('core', 'delete_confirm');
|
||||||
|
if(typeof e107Admin == 'undefined') var e107Admin = {}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* OnLoad Init Control
|
||||||
|
*/
|
||||||
|
e107Admin.initRules = {
|
||||||
|
'Helper': true,
|
||||||
|
'AdminMenu': false
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
<script type='text/javascript' src='".e_FILE_ABS."jslib/core/admin.js'></script>
|
||||||
|
";
|
||||||
|
|
||||||
|
return $ret;
|
||||||
|
}
|
||||||
?>
|
?>
|
||||||
|
@@ -9,8 +9,8 @@
|
|||||||
* Message Handler
|
* Message Handler
|
||||||
*
|
*
|
||||||
* $Source: /cvs_backup/e107_0.8/e107_handlers/message_handler.php,v $
|
* $Source: /cvs_backup/e107_0.8/e107_handlers/message_handler.php,v $
|
||||||
* $Revision: 1.9 $
|
* $Revision: 1.10 $
|
||||||
* $Date: 2008-12-20 15:23:48 $
|
* $Date: 2008-12-23 16:25:06 $
|
||||||
* $Author: secretr $
|
* $Author: secretr $
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@@ -91,6 +91,8 @@ class eMessage
|
|||||||
*/
|
*/
|
||||||
function add($message, $type = E_MESSAGE_INFO, $session = false)
|
function add($message, $type = E_MESSAGE_INFO, $session = false)
|
||||||
{
|
{
|
||||||
|
if(empty($message)) return $this;
|
||||||
|
|
||||||
if(!$session)
|
if(!$session)
|
||||||
{
|
{
|
||||||
if($this->isType($type)) $this->_sysmsg[$type][] = $message;
|
if($this->isType($type)) $this->_sysmsg[$type][] = $message;
|
||||||
@@ -108,6 +110,8 @@ class eMessage
|
|||||||
*/
|
*/
|
||||||
function addSession($message, $type = E_MESSAGE_INFO)
|
function addSession($message, $type = E_MESSAGE_INFO)
|
||||||
{
|
{
|
||||||
|
if(empty($message)) return $this;
|
||||||
|
|
||||||
if($this->isType($type)) $_SESSION['e107_system_messages'][$type][] = $message;
|
if($this->isType($type)) $_SESSION['e107_system_messages'][$type][] = $message;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
@@ -4,9 +4,9 @@
|
|||||||
| e107 website system - Language File.
|
| e107 website system - Language File.
|
||||||
|
|
|
|
||||||
| $Source: /cvs_backup/e107_0.8/e107_languages/English/admin/lan_fla.php,v $
|
| $Source: /cvs_backup/e107_0.8/e107_languages/English/admin/lan_fla.php,v $
|
||||||
| $Revision: 1.2 $
|
| $Revision: 1.3 $
|
||||||
| $Date: 2007-12-26 13:21:34 $
|
| $Date: 2008-12-23 16:25:06 $
|
||||||
| $Author: e107steved $
|
| $Author: secretr $
|
||||||
+----------------------------------------------------------------------------+
|
+----------------------------------------------------------------------------+
|
||||||
*/
|
*/
|
||||||
define("FLALAN_1", "Failed login attempts");
|
define("FLALAN_1", "Failed login attempts");
|
||||||
@@ -28,4 +28,5 @@ define("FLALAN_16", "delete this auto ban list");
|
|||||||
define("FLALAN_17", "Auto-ban list deleted");
|
define("FLALAN_17", "Auto-ban list deleted");
|
||||||
define('FLALAN_18', "Could not ban IP address --IP-- - on whitelist");
|
define('FLALAN_18', "Could not ban IP address --IP-- - on whitelist");
|
||||||
|
|
||||||
|
define('FLALAN_19', "Check All Delete");
|
||||||
?>
|
?>
|
Reference in New Issue
Block a user