Sophie

Sophie

distrib > Mandriva > 2010.2 > x86_64 > by-pkgid > 6497b94d9eff62b394767db245a2eba7 > files > 4

apache-mod_anticrack-0.3-10mdv2010.1.x86_64.rpm

<?php
/*
 * Apache 2.0 Anti-Cracking Detection and Prevention Module v0.3
 * This is a junky tool to help manage the database table used by mod_anticrack
 * (C) 2004-2005 Joseph W. Benden, Sr., CCNA
 *
 * This program is 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.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307, USA.
 *
 * For the latest version: http://www.uglyboxindustries.com/
 *
 */


/* Database host */	
define(DB_HOST,"localhost");
/* database username */
define(DB_USER,"root");
/* database password */
define(DB_PASS,"");
/* database name */
define(DB_NAME,"anticrack");
/* database table name */
define(DB_TBL,"ban");

/* Place the non-caching header and the non terminating header */
error_reporting( 1 );
ignore_user_abort(true);
header("Pragma: no-cache" );
header("Cache-Control: no-cache, must-revalidate" );

/* Begin page */
mysql_pconnect(DB_HOST,DB_USER,DB_PASS);
if( $Action == 1 && $id > 0 ) {
	$sql = "DELETE FROM ".DB_TBL." WHERE id='".addslashes(stripslashes($id))."'";
	mysql_db_query(DB_NAME,$sql);
	echo $sql;
}

	
/* Functions */
function draw_coolbox( $title, $message, $width, $nav ) {

return "<table bgcolor=\"#000000\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"$width\" align=\"CENTER\">
<tr>
<td>
        <table border=\"0\" width=\"100%\" bgcolor=\"#909090\" cellpadding=\"2\" cellspacing=\"1\">
        <tr bgcolor=\"#a9a9a9\">
        <td align=\"LEFT\" valign=\"MIDDLE\" bgcolor=\"#909090\"><font color=\"#ffffff\" size=\"-1\">&nbsp;$title</font></td>
        <td align=\"RIGHT\" valign=\"MIDDLE\" bgcolor=\"#909090\">$nav&nbsp;</td>
        </tr>

        <tr bgcolor=\"#e6e6e6\">
        <td valign=\"BASELINES\" colspan=\"2\">

        <table border=\"0\" align=\"CENTER\" bgcolor=\"#e6e6e6\" width=\"100%\" cellpadding=\"0\" cellspacing=\"0\">
                <tr bgcolor=\"#e6e6e6\">
                <td align=\"CENTER\">&nbsp;</td>
                </tr>

                <!-- Internal Table -->

                <tr bgcolor=\"#e6e6e6\">
                        <td align=\"CENTER\">$message</td>
                </tr>
                <!-- End Internal Table -->

                <tr bgcolor=\"#e6e6e6\">
                <td align=\"CENTER\">&nbsp;</td>
                </tr>
        </table>
        </td>
        </tr>
        </table>
</td>
</tr>
</table>";

} // end function draw_coolbox

function formated_datetime( $val ) {
	if( strlen($val) > 10 ) {
		$ret = substr($val,4,2) . "/" . substr($val,6,2) . "/" . substr($val,0,4) . " " . substr($val,8,2) . ":" . substr($val,10,2) . ":" . substr($val,12,2);
	} else {
		$ret = "";
	}
	return $ret;
}

?>
<html>
<head>
<title>Ban IP(Search) Admin</title>
</head>
<body>
<center>
<form NAME='IP' action='ipSearch.php' method='POST'>
<center> <p><input TYPE='TEXT' NAME='txtIP' VALUE='' SIZE='16'><br><br>
<input TYPE='Submit' VALUE='Search for IP' style='background-color:#909090;color:#ffffff;'><br><br>
<?php
	if ($txtIP=="") {
		$i = "<center>Please enter an IP Address.</center><br><br>";
	} else {
		$i = "<center>Below is the IP address that you searched for.</center><br><br>";
	}
	$i .= "<table cellspacing=\"0\" cellpadding=\"0\" border=\"1\" width=\"100%\">";
	$i .= "<tr  bgcolor=\"#909090\"><td width=\"10%\">Functions</td><td>IP Address</td><td>Last Access</td><td>Attempts</td></tr>";
	$sql = "SELECT * FROM ban where ipaddr='".$addslashes(stripslashes(txtIP))."'";
	$rs = mysql_db_query(DB_NAME,$sql);
	echo mysql_error();
	while( $row=mysql_fetch_array($rs) )
	{
		$acc = 
		$i .= "<tr><td width=\"10%\"><a href=\"ipSearch.php?Action=1&id=$row[id]\">Unblock</a></td><td>$row[ipaddr]</td><td>".formated_datetime($row[lastattempt])."</td><td>$row[counter]</td></tr>";	
	}	
	$i .= "</table>";
	echo draw_coolbox("<font size=\"+1\">Ban IP Address(Search) Admin</font>",$i,"95%","<a href=\"ipSearch.php\">Return to IP Admin Main</a>");
?>
</center>
</body></html>