<?php

$mip = $_POST['ipaddress'];


session_start();

include "../header.php";
include "../config.php";
include "../style.php";

if( isset($_SESSION["alogin"]) ) {

    	?><table>
      	<tr>
        <td width="15%" valign=top><br>
        <? include("adminnavigation.php"); ?>
        </td>
        <td valign="top" align="center"><br><br> <?
    echo "<font size=2 face='$fonttype' color='$fontcolour'><p><b><center>";
	
		if($mip == '')
		{
			?>The IP text box was empty, could <font color="red">not</font> ban IP!<br><br>
	
			Click <a href="leaves_banip.php">here</a> to return to the Leaves IP Settings page.<?
			exit;
		}
	
	
		//////////////////////////////////////////////////////////
		//////////// E-mail notification to the Admin ////////////
		/////////// Part of the Deleted members script ///////////
		//////////////// Coded by Jonathan, v0.1 /////////////////
		//////////////////////////////////////////////////////////
		//Get the options of Leaves
		$options = mysql_query ("select * from leaves_bannedips where ip='$mip'");
					
		$numrows = mysql_num_rows($options);

		if ($numrows>0)
		{
			?>The IP <? $mip ?> <font color="red">is already banned</font>.<br><br>
	
			Click <a href="leaves_banip.php">here</a> to return to the Leaves IP Settings page.<?
			exit;
		}
		
		$query1 = "insert into leaves_bannedips (ip) values ('$mip')";
			$result1 = mysql_query ($query1);
		
		?>The IP <? $mip ?> <font color=green>has been banned</font>.<br><br>
	
	Click <a href="leaves_banip.php">here</a> to return to the Leaves IP Settings page.<?

    echo "</table></td></tr></table>";
    }

else  {
	echo "Unauthorised Access!";
    }

include "../footer.php";
mysql_close($dblink);
?>