File size: 3.41Kb
<?php
// YANG HACK JANGAN HILANGKAN LISENSI INI
// HTTP://INDWAP.COM
// DAMAI SELALU TAK PERNAH JAIL KARENA TIDAK BISA APA-APA
// SCRIPT BY ULOKI.COM
// REMODIF BY ANTOQ
// HTTP://FACEBOOK.COM/WWW.INDWAP.ORG
require("../include/init.php");
if($group[$user->groupid]['type'] < 3)
{
forward("index.php");
}
include "../include/header.php";
echo '<div class="phdr">IP Banning</div>';
?>
<table class="smalltable">
<tr style="background-color:#cccccc;"><td><a href="ipban.php?do=new">Add IP</a></td></tr>
</table><br/>
<?php
if($group[$user->groupid]['type'] == 3)
{
err_msg("Admin CP","You dont have this right to perform this section.","</td></tr></table>");
}
if(isset($_GET['do']))
$do=$_GET['do'];
else
$do="";
if($do=="new")
{
if(isset($_POST['save']))
{
$bip=$_POST['bip'];
if(strlen($bip) == 0)
{
err_msg("Admin CP","Provide some IP to ban.","</td></tr></table>");
}
$db->insert_data("INSERT INTO b_banip(ip) VALUES('$bip')");
err_msg("Admin CP","IP banned from accessing forum. <a href=\"ipban.php\">Click here</a>","</td></tr></table>");
}
else
{
?>
<form action="ipban.php?do=new" method="POST">
<table class="smalltable">
<tr><td>IP Address: <br/><input type="text" name="bip" value=""/></td> </tr>
<tr><td><input type="submit" name="save" value="Add IP"/> </td> </tr>
</table>
</form>
<?php
}
}
else if($do=="edit")
{
$id=$_GET['id'];
$ip=$db->get_row("SELECT * FROM b_banip WHERE ipid='$id'");
if(isset($_POST['save']))
{
$bip=$_POST['bip'];
if(strlen($bip) == 0)
{
err_msg("Admin CP","Provide IP address which is to be banned.","</td></tr></table>");
}
$db->update_data("UPDATE b_banip SET ip='$bip' WHERE ipid='$id'");
err_msg("Admin CP","IP address edited. <a href=\"ipban.php\">Click here</a>","</td></tr></table>");
}
else
{
?>
<form action="ipban.php?do=edit&id=<?php echo $id; ?>" method="POST">
<table class="smalltable">
<tr><td>IP Address: <br/><input type="text" name="bip" value="<?php echo $ip->ip; ?>"/></td> </tr>
<tr><td><input type="submit" name="save" value="Save"/> </td> </tr>
</table>
</form>
<?php
}
}
else if($do=="delete")
{
$id=$_GET['id'];
$ip=$db->get_row("SELECT * FROM b_banip WHERE ipid='$id'");
if(isset($_POST['yes']))
{
$db->delete_data("DELETE FROM b_banip WHERE ipid='$id'");
err_msg("Admin CP","Banned ip removed from list. <a href=\"ipban.php\">Click here</a>","</td></tr></table>");
}
else
{
?>
<form action="ipban.php?do=delete&id=<?php echo $id; ?>" method="POST">
Are you sure that you have to remove this IP from ban list ?<br/>
<br/> <input type="submit" name="yes" value="Yes"/> | <a href="javascript:history.back();">Back</a>
</form>
<?php
}
}
else
{
?>
<table class="smalltable">
<?php
$iplist=$db->select("SELECT * FROM b_banip");
if($iplist)
{ print "<tr style=\"background-color:#cccccc;\"><td><b>Banned IP</b></td></tr>";
foreach($iplist as $ip)
print "<tr style=\"background-color:#cccccc;\"><td>".$ip->ip."</td><td width=\"60\"><a href=\"ipban.php?do=edit&id=".$ip->ipid."\">Edit</a></td><td width=\"60\"><a href=\"ipban.php?do=delete&id=".$ip->ipid."\">Delete</a></td></tr>";
}
else
{
print "<tr class=\"forumrow2\"><td><center>No IP is banned from accessing forum.</center></td></tr>";
}
?>
</table><br/>
<?php
}
echo '<div class="phdr"><a href="index.php">Admin Panel</a> | <a href="ipban.php">Kembali</a></div>';
include "../include/footer.php";
?>