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

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