Files
ipban199/index.php
2026-03-16 02:27:59 -04:00

179 lines
5.0 KiB
PHP

<?php
session_start();
if (!isset( $_SESSION['user_id'] ) ) {
// Redirect them to the login page
header("Location: login.php");
}
?>
<?php
include('header.php');
?>
<script>
$(document).ready(function(){
var date_input=$('input[name="date"]'); //our date input has the name "date"
var container=$('.bootstrap-iso form').length>0 ? $('.bootstrap-iso form').parent() : "body";
var options={
format: 'yyyy-mm-dd',
container: container,
todayHighlight: true,
autoclose: true,
};
date_input.datepicker(options);
})
</script>
<?php
include('topmenu.php');
include('conn.php');
include('functions.php');
?>
<div class="container" style="width:100%; padding-left:20px; padding-right:20px">
<h2>Find IP records</h2>
<form name="search_form" action="search_db.php" method="POST">
<div class="form-group">
<div class="row line10">
<div class="form-check form-check-inline col-sm-2">
</div>
<div class="form-check form-check-inline col-sm-3">
<label class="form-check-label" for="button1">
<input class="form-check-input" type="radio" name="listtype" id="button1" value="a" checked>
All
</label>
</div>
<div class="form-check form-check-inline col-sm-3">
<label class="form-check-label" for="button2">
<input class="form-check-input" type="radio" name="listtype" id="button2" value="b">
Blacklist
</label>
</div>
<div class="form-check form-check-inline col-sm-3">
<label class="form-check-label" for="button3">
<input class="form-check-input" type="radio" name="listtype" id="button3" value="w">
Whitelist
</label>
</div>
</div>
<div class="row line10">
<div class="col-sm-2">
</div>
<div class="col-sm-10">
<input name="IP" type="text" placeholder="Search by IP" class="form-control"><br>
</div>
</div>
<div class="row line10">
<div class="col-sm-2">
</div>
<div class="col-sm-10">
<select class="form-control" name="type">
<option value='-1' selected>- Search by Type -</option>
<?php
$sql_type="SELECT type,label FROM type WHERE status='1' ORDER BY type";
$sql_rez=mysqli_query($con,$sql_type);
while($row_type=mysqli_fetch_array($sql_rez)){
echo "<option value='".$row_type['type']."'>".$row_type['label']."</option>";
}
?>
</select>
<br>
</div>
</div>
<div class="row line10">
<div class="col-sm-2">
</div>
<div class="col-sm-10">
<input name="date" id='date' type="text" placeholder="Search by Date" class="form-control"><br>
</div>
</div>
<div class="row line10">
<div class="col-sm-2">
</div>
<div class="col-sm-10">
<button type="submit" class="btn btn-primary" style="width:100%"><i class="fa fa-search"></i> Search</button>
</div>
</div>
</form>
<div class="row line10">
<div class="col-sm-10" style="margin-top:20px">
<h3>Last 20 Entries</h3>
</div>
</div>
<div class="row line10">
<div class="col-sm-2">
</div>
<div class="col-sm-5">
<label> Whitelist</label>
<?php
$sql_w="SELECT ip,reason,enddate FROM whitelist ORDER BY adddate DESC LIMIT 20";
$rez_w=mysqli_query($con,$sql_w);
echo "<div style='text-align:center'>";
echo "<div style='display:inline-block; width:95%'>";
echo "<table class='table table-condensed table-striped table-hover' style='text-align:left'>";
echo "<tr>
<th>IP</th>
<th>End Date</th>
<th>Reason</th>
</tr>";
while($rd_w=mysqli_fetch_array($rez_w)){
echo "<tr>";
if($rd_w['enddate']=='99999999999999') {
$enddate='<B>Permanent</B>';
}
else
{
$enddate=print_datetime($rd_w['enddate']);
}
echo "<td>".$rd_w['ip']."</td>";
echo "<td>".$enddate."</td>";
echo "<td>".$rd_w['reason']."</td>";
echo "</tr>";
}
echo "</table>";
echo "</div>";
echo "</div>";
?>
</div>
<div class="col-sm-5">
<label> Blacklist</label>
<?php
$sql_b="SELECT ip,reason,enddate FROM blacklist ORDER BY adddate DESC LIMIT 20";
$rez_b=mysqli_query($con,$sql_b);
echo "<div style='text-align:center'>";
echo "<div style='display:inline-block; width:95%'>";
echo "<table class='table table-condensed table-striped table-hover' style='text-align:left'>";
echo "<tr>
<th>IP</th>
<th>End Date</th>
<th>Reason</th>
</tr>";
while($rd_b=mysqli_fetch_array($rez_b)){
echo "<tr>";
if($rd_b['enddate']=='99999999999999') {
$enddate_b='<B>Permanent</B>';
}
else
{
$enddate_b=print_datetime($rd_b['enddate']);
}
echo "<td>".$rd_b['ip']."</td>";
echo "<td>".$enddate_b."</td>";
echo "<td>".$rd_b['reason']."</td>";
echo "</tr>";
}
echo "</table>";
echo "</div>";
echo "</div>";
?>
</div>
</div>
</div>
<?php
include('footer.php');
?>