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

134 lines
3.4 KiB
PHP

<?php
//SECURE PAGE
$PageLevel = 3;
//Do not edit below
session_start();
if (!isset( $_SESSION['user_id'] ) ) {
// Redirect them to the login page
header("Location: login.php");
}
$PageAccess=false;
if ($_SESSION['user']->level >= $PageLevel) {
$PageAccess=true;
}
?>
<?php
include('header.php');
if(!empty($_GET['tbl'])&&isset($_GET['tbl'])){
$tbl=$_GET['tbl'];
if($tbl=='b'){
$table_name='blacklist';
$page_title='Add IP to Blacklist';
}
elseif ($tbl=='w'){
$table_name='whitelist';
$page_title='Add IP to Whitelist';
}
}
else{
$tbl="";
}
?>
<script type="text/javascript">
//validate form
<!--
function verificare(form)
{
if(form.ip.value == "") {
alert ("Please write a value for the IP");
form.ip.focus();
return false;
}
if(form.type.value == -1) {
alert ("Please select a type for your entry");
form.type.focus();
return false;
}
}
-->
</script>
<?php
include('topmenu.php');
include('conn.php');
include('functions.php');
?>
<?php
if (!$PageAccess) {
?>
<div style="padding-left:20px">
<h2>You do not have sufficient rights to access this page.</h2>
</div>
<?php
die();
}
?>
<div style="padding-left:20px">
<h2><?php echo $page_title?></h2>
<form name="ip" action="add_ip_save.php" method="POST" class="form-horizontal" onSubmit="return verificare(this);">
<div class="form-group">
<div class="row line10">
<label class="col-sm-2 control-label">IP: </label>
<input type="hidden" name="tbl" value="<?php echo $table_name;?>">
<div class="col-sm-8"><input name="ip" type="text" placeholder="Enter IP" class="form-control">
</div>
</div>
<br>
<div class="row line10">
<label class="col-sm-2 control-label">Block IP for: </label>
<div class="col-sm-2">
Years<input name="years" type="text" placeholder="Blocked for Years" class="form-control">
</div>
<div class="col-sm-2">
Months<input name="months" type="text" placeholder="Blocked for Months" class="form-control">
</div>
<div class="col-sm-2">
Days<input name="days" type="text" placeholder="Blocked for Days" class="form-control">
</div>
<div class="col-sm-2">
&nbsp <label for="chkb" class="form-control">Permanent -> <input id="chkb" name="perm" type="checkbox" checked> ?</label>
</div>
</div>
<br>
<div class="row line10">
<label class="col-sm-2 control-label">Reason: </label>
<div class="col-sm-8"><input name="reason" type="text" placeholder="Enter Reason" class="form-control" ></div>
</div>
<br>
<div class="row line10">
<label class="col-sm-2 control-label">Type: </label>
<div class="col-sm-8">
<select class="form-control" name="type">
<?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-8">
<input type="submit" value="Save" class="btn btn-primary">
<input type="button" value="Cancel" class="btn btn-warning" onclick='window.location.href="<?php echo"add_ip_frm.php?"; ?>"'>
</div>
</div>
</div>
</form>
</div>
<?php
include('footer.php');
?>