Location: PHPKode > scripts > WebsiteMemberManager > members-section/admin/php/ban-range.php
<?php
$dbc = dbc::instance();
if (isset($save))
{
 $REMOTE_ADDR = $_SERVER['REMOTE_ADDR'];
 $IP_dots = explode(".",$REMOTE_ADDR);
 $IP_subnet = "$IP_dots[0].$IP_dots[1]";
 if ($IP_subnet==$range) $feedback->setShow("Adding that range would ban yourself!<br><br>DONT be a plonka","SILLY BILLY - action!");
 else
 {
 $query = "INSERT into wmm_blocked_ranges (`total`, `wmm_range`) VALUES (null, :range)";
 $result = $dbc->prepare($query);
 $result->bindParam(':range', $range, PDO::PARAM_STR);
 $result = $dbc->execute($result);
 $feedback->setShow("Addition of IP range successful", "Feedback");
 }
}
elseif (isset($range))
{
 $query = "DELETE from wmm_blocked_ranges where wmm_range='$range'";
 $result = $dbc->prepare($query);
 $result = $dbc->execute($result);
 $feedback->setShow("Range removal successful", "Feedback");
}
$result = $dbc->prepare("SELECT * FROM wmm_blocked_ranges");
$rows = $dbc->executeGetRows($result);
$ranges="";
if (count($rows)>0)
{
 foreach ($rows as $row)
 {
  $range=$row['wmm_range'];
  $ranges.= "<a href=\"javascript:deleteit('$range')\">DELETE: $range ...</a><br>";
 }
}
else $ranges.="<h3>Currently there are NO IP ranges banned.</h3>";
include("ban-range.html");
?>
<form name="DF" method="post">
  <input type="hidden" name="range" value>
</form>
<script LANGUAGE="JavaScript"><!--

function deleteit(range)
{
 the_message = "Are you sure you wish to DELETE "+range+"?";
 if (window.confirm(the_message))
 {
  document.DF.range.value=range;
  document.DF.action="ban-range.php";
  document.DF.submit();
 }
}
// --></script>
Return current item: WebsiteMemberManager